From 6a3ce18e4b295df8605256e931c5e6f805b78e01 Mon Sep 17 00:00:00 2001 From: Trishna Guha Date: Thu, 25 May 2017 10:50:42 +0530 Subject: [PATCH] add more testcases for nxos_evpn_vni (#24996) --- .../nxos/fixtures/nxos_evpn_vni_config.cfg | 8 ++++++++ .../modules/network/nxos/test_nxos_evpn_vni.py | 16 +++++++++++----- 2 files changed, 19 insertions(+), 5 deletions(-) create mode 100644 test/units/modules/network/nxos/fixtures/nxos_evpn_vni_config.cfg diff --git a/test/units/modules/network/nxos/fixtures/nxos_evpn_vni_config.cfg b/test/units/modules/network/nxos/fixtures/nxos_evpn_vni_config.cfg new file mode 100644 index 0000000000..b1c8352f58 --- /dev/null +++ b/test/units/modules/network/nxos/fixtures/nxos_evpn_vni_config.cfg @@ -0,0 +1,8 @@ +nv overlay evpn +feature nv overlay + +evpn + vni 6000 l2 + rd auto + route-target import auto + route-target export auto diff --git a/test/units/modules/network/nxos/test_nxos_evpn_vni.py b/test/units/modules/network/nxos/test_nxos_evpn_vni.py index 6f849fc7ae..1c587ec490 100644 --- a/test/units/modules/network/nxos/test_nxos_evpn_vni.py +++ b/test/units/modules/network/nxos/test_nxos_evpn_vni.py @@ -46,14 +46,20 @@ class TestNxosEvpnVniModule(TestNxosModule): self.mock_get_config.stop() def load_fixtures(self, commands=None): + self.get_config.return_value = load_fixture('nxos_evpn_vni_config.cfg') self.load_config.return_value = None - def test_nxos_evpn_vni_absent(self): - set_module_args(dict(vni='6000', state='absent')) - result = self.execute_module(changed=False) - self.assertEqual(result['commands'], []) - def test_nxos_evpn_vni_present(self): set_module_args(dict(vni='6000', state='present')) result = self.execute_module(changed=True) self.assertEqual(result['commands'], ['evpn', 'vni 6000 l2']) + + def test_nxos_evpn_vni_absent_not_existing(self): + set_module_args(dict(vni='12000', state='absent')) + result = self.execute_module(changed=False) + self.assertEqual(result['commands'], []) + + def test_nxos_evpn_vni_absent_existing(self): + set_module_args(dict(vni='6000', state='absent')) + result = self.execute_module(changed=True) + self.assertEqual(result['commands'], ['evpn', 'no vni 6000 l2'])