summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorWim de With <wf@dewith.io>2020-12-09 01:25:04 +0100
committerGitHub <noreply@github.com>2020-12-09 00:25:04 +0000
commit59dad0ffed43b0f7fc3026fc8014e2092cb5b68b (patch)
treeb0e5124337b960a40eba47dd947e770c5ee8b9b8 /tests
parent6c51003d205242acd18bdfb6bd3400c5cfdba419 (diff)
downloadvyos-ansible-old-59dad0ffed43b0f7fc3026fc8014e2092cb5b68b.tar.gz
vyos-ansible-old-59dad0ffed43b0f7fc3026fc8014e2092cb5b68b.zip
vyos_config: Fix config being processed as command (#94)
vyos_config: Fix config being processed as command Reviewed-by: https://github.com/apps/ansible-zuul
Diffstat (limited to 'tests')
-rw-r--r--tests/unit/modules/network/vyos/fixtures/vyos_config_src_brackets.cfg9
-rw-r--r--tests/unit/modules/network/vyos/test_vyos_config.py8
2 files changed, 11 insertions, 6 deletions
diff --git a/tests/unit/modules/network/vyos/fixtures/vyos_config_src_brackets.cfg b/tests/unit/modules/network/vyos/fixtures/vyos_config_src_brackets.cfg
index 468b32c..81c06b2 100644
--- a/tests/unit/modules/network/vyos/fixtures/vyos_config_src_brackets.cfg
+++ b/tests/unit/modules/network/vyos/fixtures/vyos_config_src_brackets.cfg
@@ -8,6 +8,15 @@ interfaces {
disable
}
}
+policy {
+ route testroute {
+ rule 1 {
+ set {
+ table 10
+ }
+ }
+ }
+}
system {
host-name foo
}
diff --git a/tests/unit/modules/network/vyos/test_vyos_config.py b/tests/unit/modules/network/vyos/test_vyos_config.py
index a471edd..3c49d3a 100644
--- a/tests/unit/modules/network/vyos/test_vyos_config.py
+++ b/tests/unit/modules/network/vyos/test_vyos_config.py
@@ -106,16 +106,12 @@ class TestVyosConfigModule(TestVyosModule):
def test_vyos_config_src_brackets(self):
src = load_fixture("vyos_config_src_brackets.cfg")
set_module_args(dict(src=src))
- candidate = "\n".join(self.module.format_commands(src.splitlines()))
commands = [
"set interfaces ethernet eth0 address 10.10.10.10/24",
+ "set policy route testroute rule 1 set table 10",
"set system host-name foo",
]
- self.conn.get_diff = MagicMock(
- return_value=self.cliconf_obj.get_diff(
- candidate, self.running_config
- )
- )
+ self.conn.get_diff = MagicMock(side_effect=self.cliconf_obj.get_diff)
self.execute_module(changed=True, commands=commands)
def test_vyos_config_backup(self):