diff --git a/test/units/modules/network/nxos/fixtures/nxos_nxapi/n3k/show_nxapi b/test/units/modules/network/nxos/fixtures/nxos_nxapi/n3k/show_nxapi new file mode 100644 index 00000000000..54dd7d778e6 --- /dev/null +++ b/test/units/modules/network/nxos/fixtures/nxos_nxapi/n3k/show_nxapi @@ -0,0 +1,2 @@ +nxapi enabled +HTTP Listen on port 80 diff --git a/test/units/modules/network/nxos/fixtures/nxos_nxapi/show_nxapi b/test/units/modules/network/nxos/fixtures/nxos_nxapi/n7k/show_nxapi similarity index 100% rename from test/units/modules/network/nxos/fixtures/nxos_nxapi/show_nxapi rename to test/units/modules/network/nxos/fixtures/nxos_nxapi/n7k/show_nxapi diff --git a/test/units/modules/network/nxos/nxos_module.py b/test/units/modules/network/nxos/nxos_module.py index 53972c80c84..77b5785b7e3 100644 --- a/test/units/modules/network/nxos/nxos_module.py +++ b/test/units/modules/network/nxos/nxos_module.py @@ -36,8 +36,10 @@ fixture_path = os.path.join(os.path.dirname(__file__), 'fixtures') fixture_data = {} -def load_fixture(name): - path = os.path.join(fixture_path, name) +def load_fixture(module_name, name, device=''): + path = os.path.join(fixture_path, module_name, device, name) + if not os.path.exists(path): + path = os.path.join(fixture_path, module_name, name) if path in fixture_data: return fixture_data[path] @@ -64,9 +66,27 @@ class AnsibleFailJson(Exception): class TestNxosModule(unittest.TestCase): - def execute_module(self, failed=False, changed=False, commands=None, sort=True, defaults=False): + def execute_module_devices(self, failed=False, changed=False, commands=None, sort=True, defaults=False): + module_name = self.module.__name__.rsplit('.', 1)[1] + local_fixture_path = os.path.join(fixture_path, module_name) - self.load_fixtures(commands) + models = [] + for path in os.listdir(local_fixture_path): + path = os.path.join(local_fixture_path, path) + if os.path.isdir(path): + models.append(os.path.basename(path)) + if not models: + models = [''] + + retvals = {} + for model in models: + retvals[model] = self.execute_module(failed, changed, commands, sort, device=model) + + return retvals + + def execute_module(self, failed=False, changed=False, commands=None, sort=True, device=''): + + self.load_fixtures(commands, device=device) if failed: result = self.failed() @@ -110,5 +130,5 @@ class TestNxosModule(unittest.TestCase): self.assertEqual(result['changed'], changed, result) return result - def load_fixtures(self, commands=None): + def load_fixtures(self, commands=None, device=''): pass diff --git a/test/units/modules/network/nxos/test_nxos_acl.py b/test/units/modules/network/nxos/test_nxos_acl.py index a680d2e216e..6c2163fa053 100644 --- a/test/units/modules/network/nxos/test_nxos_acl.py +++ b/test/units/modules/network/nxos/test_nxos_acl.py @@ -41,7 +41,7 @@ class TestNxosAclModule(TestNxosModule): self.mock_run_commands.stop() self.mock_load_config.stop() - def load_fixtures(self, commands=None): + def load_fixtures(self, commands=None, device=''): def load_from_file(*args, **kwargs): module, commands = args output = list() @@ -52,9 +52,8 @@ class TestNxosAclModule(TestNxosModule): command = obj['command'] except ValueError: command = item - filename = str(command).split(' | ')[0].replace(' ', '_') - filename = 'nxos_acl/%s.txt' % filename - output.append(load_fixture(filename)) + filename = '%s.txt' % str(command).split(' | ')[0].replace(' ', '_') + output.append(load_fixture('nxos_acl', filename)) return output self.run_commands.side_effect = load_from_file diff --git a/test/units/modules/network/nxos/test_nxos_acl_interface.py b/test/units/modules/network/nxos/test_nxos_acl_interface.py index 0b7e2288211..f3db93f107c 100644 --- a/test/units/modules/network/nxos/test_nxos_acl_interface.py +++ b/test/units/modules/network/nxos/test_nxos_acl_interface.py @@ -41,7 +41,7 @@ class TestNxosAclInterfaceModule(TestNxosModule): self.mock_run_commands.stop() self.mock_load_config.stop() - def load_fixtures(self, commands=None): + def load_fixtures(self, commands=None, device=''): def load_from_file(*args, **kwargs): module, commands = args output = list() @@ -52,9 +52,8 @@ class TestNxosAclInterfaceModule(TestNxosModule): command = obj['command'] except ValueError: command = item - filename = str(command).split(' | ')[0].replace(' ', '_') - filename = 'nxos_acl_interface/%s.txt' % filename - output.append(load_fixture(filename)) + filename = '%s.txt' % str(command).split(' | ')[0].replace(' ', '_') + output.append(load_fixture('nxos_acl_interface', filename)) return output self.run_commands.side_effect = load_from_file diff --git a/test/units/modules/network/nxos/test_nxos_banner.py b/test/units/modules/network/nxos/test_nxos_banner.py index 3bd3ea7f817..216361f3850 100644 --- a/test/units/modules/network/nxos/test_nxos_banner.py +++ b/test/units/modules/network/nxos/test_nxos_banner.py @@ -39,7 +39,7 @@ class TestNxosBannerModule(TestNxosModule): self.mock_run_commands.stop() self.mock_load_config.stop() - def load_fixtures(self, commands=None): + def load_fixtures(self, commands=None, device=''): self.load_config.return_value = dict(diff=None, session='session') def test_nxos_banner_create(self): diff --git a/test/units/modules/network/nxos/test_nxos_bgp.py b/test/units/modules/network/nxos/test_nxos_bgp.py index fbdfcfaf778..2d3cdedb331 100644 --- a/test/units/modules/network/nxos/test_nxos_bgp.py +++ b/test/units/modules/network/nxos/test_nxos_bgp.py @@ -41,8 +41,8 @@ class TestNxosBgpModule(TestNxosModule): self.mock_load_config.stop() self.mock_get_config.stop() - def load_fixtures(self, commands=None): - self.get_config.return_value = load_fixture('nxos_bgp_config.cfg') + def load_fixtures(self, commands=None, device=''): + self.get_config.return_value = load_fixture('', 'nxos_bgp_config.cfg') self.load_config.return_value = None def test_nxos_bgp(self): diff --git a/test/units/modules/network/nxos/test_nxos_bgp_af.py b/test/units/modules/network/nxos/test_nxos_bgp_af.py index 3b75ecb4dd3..b3c7f0bb193 100644 --- a/test/units/modules/network/nxos/test_nxos_bgp_af.py +++ b/test/units/modules/network/nxos/test_nxos_bgp_af.py @@ -41,8 +41,8 @@ class TestNxosBgpAfModule(TestNxosModule): self.mock_load_config.stop() self.mock_get_config.stop() - def load_fixtures(self, commands=None): - self.get_config.return_value = load_fixture('nxos_bgp_config.cfg') + def load_fixtures(self, commands=None, device=''): + self.get_config.return_value = load_fixture('', 'nxos_bgp_config.cfg') self.load_config.return_value = None def test_nxos_bgp_af(self): diff --git a/test/units/modules/network/nxos/test_nxos_bgp_neighbor.py b/test/units/modules/network/nxos/test_nxos_bgp_neighbor.py index 6be7a30d4ef..6ae5f996882 100644 --- a/test/units/modules/network/nxos/test_nxos_bgp_neighbor.py +++ b/test/units/modules/network/nxos/test_nxos_bgp_neighbor.py @@ -41,8 +41,8 @@ class TestNxosBgpNeighborModule(TestNxosModule): self.mock_load_config.stop() self.mock_get_config.stop() - def load_fixtures(self, commands=None): - self.get_config.return_value = load_fixture('nxos_bgp_config.cfg') + def load_fixtures(self, commands=None, device=''): + self.get_config.return_value = load_fixture('', 'nxos_bgp_config.cfg') self.load_config.return_value = None def test_nxos_bgp_neighbor(self): diff --git a/test/units/modules/network/nxos/test_nxos_bgp_neighbor_af.py b/test/units/modules/network/nxos/test_nxos_bgp_neighbor_af.py index c29cc52a565..49959a45272 100644 --- a/test/units/modules/network/nxos/test_nxos_bgp_neighbor_af.py +++ b/test/units/modules/network/nxos/test_nxos_bgp_neighbor_af.py @@ -41,8 +41,8 @@ class TestNxosBgpNeighborAfModule(TestNxosModule): self.mock_load_config.stop() self.mock_get_config.stop() - def load_fixtures(self, commands=None): - self.get_config.return_value = load_fixture('nxos_bgp_config.cfg') + def load_fixtures(self, commands=None, device=''): + self.get_config.return_value = load_fixture('', 'nxos_bgp_config.cfg') self.load_config.return_value = None def test_nxos_bgp_neighbor_af(self): diff --git a/test/units/modules/network/nxos/test_nxos_command.py b/test/units/modules/network/nxos/test_nxos_command.py index 9a3eeef2899..fac4604f05d 100644 --- a/test/units/modules/network/nxos/test_nxos_command.py +++ b/test/units/modules/network/nxos/test_nxos_command.py @@ -37,7 +37,7 @@ class TestNxosCommandModule(TestNxosModule): def tearDown(self): self.mock_run_commands.stop() - def load_fixtures(self, commands=None): + def load_fixtures(self, commands=None, device=''): def load_from_file(*args, **kwargs): module, commands = args output = list() @@ -48,9 +48,8 @@ class TestNxosCommandModule(TestNxosModule): command = obj['command'] except ValueError: command = item['command'] - filename = str(command).replace(' ', '_') - filename = 'nxos_command/%s.txt' % filename - output.append(load_fixture(filename)) + filename = '%s.txt' % str(command).replace(' ', '_') + output.append(load_fixture('nxos_command', filename)) return output self.run_commands.side_effect = load_from_file diff --git a/test/units/modules/network/nxos/test_nxos_config.py b/test/units/modules/network/nxos/test_nxos_config.py index d3a02b877be..42e178ab941 100644 --- a/test/units/modules/network/nxos/test_nxos_config.py +++ b/test/units/modules/network/nxos/test_nxos_config.py @@ -43,8 +43,8 @@ class TestNxosConfigModule(TestNxosModule): self.mock_get_config.stop() self.mock_load_config.stop() - def load_fixtures(self, commands=None): - self.get_config.return_value = load_fixture('nxos_config/config.cfg') + def load_fixtures(self, commands=None, device=''): + self.get_config.return_value = load_fixture('nxos_config', 'config.cfg') self.load_config.return_value = None def test_nxos_config_no_change(self): @@ -53,7 +53,7 @@ class TestNxosConfigModule(TestNxosModule): result = self.execute_module() def test_nxos_config_src(self): - args = dict(src=load_fixture('nxos_config/candidate.cfg')) + args = dict(src=load_fixture('nxos_config', 'candidate.cfg')) set_module_args(args) result = self.execute_module(changed=True) diff --git a/test/units/modules/network/nxos/test_nxos_evpn_global.py b/test/units/modules/network/nxos/test_nxos_evpn_global.py index 081595e7605..1adce68b825 100644 --- a/test/units/modules/network/nxos/test_nxos_evpn_global.py +++ b/test/units/modules/network/nxos/test_nxos_evpn_global.py @@ -41,15 +41,15 @@ class TestNxosEvpnGlobalModule(TestNxosModule): self.mock_get_config.stop() self.mock_load_config.stop() - def load_fixtures(self, commands=None): + def load_fixtures(self, commands=None, device=''): self.load_config.return_value = None def start_configured(self, *args, **kwargs): - self.get_config.return_value = load_fixture('nxos_evpn_global/configured.cfg') + self.get_config.return_value = load_fixture('nxos_evpn_global', 'configured.cfg') return self.execute_module(*args, **kwargs) def start_unconfigured(self, *args, **kwargs): - self.get_config.return_value = load_fixture('nxos_evpn_global/unconfigured.cfg') + self.get_config.return_value = load_fixture('nxos_evpn_global', 'unconfigured.cfg') return self.execute_module(*args, **kwargs) def test_nxos_evpn_global_enable(self): 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 c460b733a3c..8ee0aad3f58 100644 --- a/test/units/modules/network/nxos/test_nxos_evpn_vni.py +++ b/test/units/modules/network/nxos/test_nxos_evpn_vni.py @@ -45,8 +45,8 @@ class TestNxosEvpnVniModule(TestNxosModule): self.mock_load_config.stop() self.mock_get_config.stop() - def load_fixtures(self, commands=None): - self.get_config.return_value = load_fixture('nxos_evpn_vni_config.cfg') + def load_fixtures(self, commands=None, device=''): + self.get_config.return_value = load_fixture('', 'nxos_evpn_vni_config.cfg') self.load_config.return_value = None def test_nxos_evpn_vni_present(self): diff --git a/test/units/modules/network/nxos/test_nxos_feature.py b/test/units/modules/network/nxos/test_nxos_feature.py index c39f1d9c071..60fd4aab1f4 100644 --- a/test/units/modules/network/nxos/test_nxos_feature.py +++ b/test/units/modules/network/nxos/test_nxos_feature.py @@ -41,7 +41,7 @@ class TestNxosFeatureModule(TestNxosModule): self.mock_run_commands.stop() self.mock_load_config.stop() - def load_fixtures(self, commands=None): + def load_fixtures(self, commands=None, device=''): def load_from_file(*args, **kwargs): module, commands = args output = list() @@ -52,9 +52,8 @@ class TestNxosFeatureModule(TestNxosModule): command = obj['command'] except ValueError: command = item['command'] - filename = str(command).replace(' ', '_') - filename = 'nxos_feature/%s.txt' % filename - output.append(load_fixture(filename)) + filename = '%s.txt' % str(command).replace(' ', '_') + output.append(load_fixture('nxos_feature', filename)) return output self.run_commands.side_effect = load_from_file diff --git a/test/units/modules/network/nxos/test_nxos_hsrp.py b/test/units/modules/network/nxos/test_nxos_hsrp.py index e1b8fbe2d45..cd96cdd63ab 100644 --- a/test/units/modules/network/nxos/test_nxos_hsrp.py +++ b/test/units/modules/network/nxos/test_nxos_hsrp.py @@ -41,7 +41,7 @@ class TestNxosHsrpModule(TestNxosModule): self.mock_run_commands.stop() self.mock_load_config.stop() - def load_fixtures(self, commands=None): + def load_fixtures(self, commands=None, device=''): self.load_config.return_value = None def test_nxos_hsrp(self): diff --git a/test/units/modules/network/nxos/test_nxos_interface.py b/test/units/modules/network/nxos/test_nxos_interface.py index 42c3943f37e..769fa1612ab 100644 --- a/test/units/modules/network/nxos/test_nxos_interface.py +++ b/test/units/modules/network/nxos/test_nxos_interface.py @@ -45,7 +45,7 @@ class TestNxosInterfaceModule(TestNxosModule): self.mock_load_config.stop() self.mock_get_config.stop() - def load_fixtures(self, commands=None): + def load_fixtures(self, commands=None, device=''): self.load_config.return_value = None def test_nxos_interface_up(self): diff --git a/test/units/modules/network/nxos/test_nxos_ip_interface.py b/test/units/modules/network/nxos/test_nxos_ip_interface.py index 3125b1984c6..f70047cac0e 100644 --- a/test/units/modules/network/nxos/test_nxos_ip_interface.py +++ b/test/units/modules/network/nxos/test_nxos_ip_interface.py @@ -47,9 +47,9 @@ class TestNxosIPInterfaceModule(TestNxosModule): self.mock_send_show_command.stop() self.mock_load_config.stop() - def load_fixtures(self, commands=None): + def load_fixtures(self, commands=None, device=''): self.get_interface_mode.return_value = 'layer3' - self.send_show_command.return_value = [load_fixture('nxos_ip_interface.cfg')] + self.send_show_command.return_value = [load_fixture('', 'nxos_ip_interface.cfg')] self.load_config.return_value = None def test_nxos_ip_interface_ip_present(self): diff --git a/test/units/modules/network/nxos/test_nxos_nxapi.py b/test/units/modules/network/nxos/test_nxos_nxapi.py index 78c49467ced..9b4e089a32f 100644 --- a/test/units/modules/network/nxos/test_nxos_nxapi.py +++ b/test/units/modules/network/nxos/test_nxos_nxapi.py @@ -42,15 +42,15 @@ class TestNxosNxapiModule(TestNxosModule): self.mock_run_commands.stop() self.mock_load_config.stop() - def load_fixtures(self, commands=None): + def load_fixtures(self, commands=None, device=''): def load_from_file(*args, **kwargs): module, commands = args - output = list() + module_name = self.module.__name__.rsplit('.', 1)[1] + output = list() for command in commands: - filename = str(command).replace(' ', '_') - filename = os.path.join('nxos_nxapi', filename) - output.append(load_fixture(filename)) + filename = str(command).split(' | ')[0].replace(' ', '_') + output.append(load_fixture(module_name, filename, device)) return output self.run_commands.side_effect = load_from_file @@ -58,12 +58,12 @@ class TestNxosNxapiModule(TestNxosModule): def test_nxos_nxapi_no_change(self): set_module_args(dict(http=True, https=False, http_port=80, https_port=443, sandbox=False)) - self.execute_module(changed=False, commands=[]) + self.execute_module_devices(changed=False, commands=[]) def test_nxos_nxapi_disable(self): set_module_args(dict(state='absent')) - self.execute_module(changed=True, commands=['no feature nxapi']) + self.execute_module_devices(changed=True, commands=['no feature nxapi']) def test_nxos_nxapi_no_http(self): set_module_args(dict(https=True, http=False, https_port=8443)) - self.execute_module(changed=True, commands=['no nxapi http', 'nxapi https port 8443']) + self.execute_module_devices(changed=True, commands=['no nxapi http', 'nxapi https port 8443']) diff --git a/test/units/modules/network/nxos/test_nxos_ospf.py b/test/units/modules/network/nxos/test_nxos_ospf.py index 4e90168af22..c2652e4b300 100644 --- a/test/units/modules/network/nxos/test_nxos_ospf.py +++ b/test/units/modules/network/nxos/test_nxos_ospf.py @@ -41,7 +41,7 @@ class TestNxosOspfModule(TestNxosModule): self.mock_load_config.stop() self.mock_get_config.stop() - def load_fixtures(self, commands=None): + def load_fixtures(self, commands=None, device=''): self.load_config.return_value = None def test_nxos_ospf_present(self): diff --git a/test/units/modules/network/nxos/test_nxos_ospf_vrf.py b/test/units/modules/network/nxos/test_nxos_ospf_vrf.py index 4b17fc726b7..1fec5aa1d5e 100644 --- a/test/units/modules/network/nxos/test_nxos_ospf_vrf.py +++ b/test/units/modules/network/nxos/test_nxos_ospf_vrf.py @@ -41,7 +41,7 @@ class TestNxosOspfVrfModule(TestNxosModule): self.mock_load_config.stop() self.mock_get_config.stop() - def load_fixtures(self, commands=None): + def load_fixtures(self, commands=None, device=''): self.load_config.return_value = None def test_nxos_ospf_vrf_present(self): diff --git a/test/units/modules/network/nxos/test_nxos_portchannel.py b/test/units/modules/network/nxos/test_nxos_portchannel.py index 684805e6a60..db4defade80 100644 --- a/test/units/modules/network/nxos/test_nxos_portchannel.py +++ b/test/units/modules/network/nxos/test_nxos_portchannel.py @@ -45,7 +45,7 @@ class TestNxosPortchannelModule(TestNxosModule): self.mock_load_config.stop() self.mock_get_config.stop() - def load_fixtures(self, commands=None): + def load_fixtures(self, commands=None, device=''): self.load_config.return_value = None def test_nxos_portchannel(self): diff --git a/test/units/modules/network/nxos/test_nxos_static_route.py b/test/units/modules/network/nxos/test_nxos_static_route.py index c4876d4a365..00abfa4db2e 100644 --- a/test/units/modules/network/nxos/test_nxos_static_route.py +++ b/test/units/modules/network/nxos/test_nxos_static_route.py @@ -41,8 +41,8 @@ class TestNxosStaticRouteModule(TestNxosModule): self.mock_load_config.stop() self.mock_get_config.stop() - def load_fixtures(self, commands=None): - self.get_config.return_value = load_fixture('nxos_static_route.cfg') + def load_fixtures(self, commands=None, device=''): + self.get_config.return_value = load_fixture('', 'nxos_static_route.cfg') self.load_config.return_value = None def test_nxos_static_route_present(self): diff --git a/test/units/modules/network/nxos/test_nxos_system.py b/test/units/modules/network/nxos/test_nxos_system.py index 0fb857ae5a9..18e2042b3c6 100644 --- a/test/units/modules/network/nxos/test_nxos_system.py +++ b/test/units/modules/network/nxos/test_nxos_system.py @@ -41,8 +41,8 @@ class TestNxosSystemModule(TestNxosModule): self.mock_get_config.stop() self.mock_load_config.stop() - def load_fixtures(self, commands=None): - self.get_config.return_value = load_fixture('nxos_system_config.cfg') + def load_fixtures(self, commands=None, device=''): + self.get_config.return_value = load_fixture('', 'nxos_system_config.cfg') self.load_config.return_value = None def test_nxos_system_hostname_changed(self): diff --git a/test/units/modules/network/nxos/test_nxos_vlan.py b/test/units/modules/network/nxos/test_nxos_vlan.py index 334ecbb20e4..ab939830337 100644 --- a/test/units/modules/network/nxos/test_nxos_vlan.py +++ b/test/units/modules/network/nxos/test_nxos_vlan.py @@ -44,7 +44,7 @@ class TestNxosVlanModule(TestNxosModule): self.mock_run_commands.stop() self.mock_load_config.stop() - def load_fixtures(self, commands=None): + def load_fixtures(self, commands=None, device=''): def load_from_file(*args, **kwargs): module, commands = args output = list() @@ -55,9 +55,8 @@ class TestNxosVlanModule(TestNxosModule): command = obj['command'] except ValueError: command = item - filename = str(command).split(' | ')[0].replace(' ', '_') - filename = 'nxos_vlan/%s.txt' % filename - output.append(load_fixture(filename)) + filename = '%s.txt' % str(command).split(' | ')[0].replace(' ', '_') + output.append(load_fixture('nxos_vlan', filename)) return output self.run_commands.side_effect = load_from_file diff --git a/test/units/modules/network/nxos/test_nxos_vpc.py b/test/units/modules/network/nxos/test_nxos_vpc.py index a3126fa8310..9944788c1bb 100644 --- a/test/units/modules/network/nxos/test_nxos_vpc.py +++ b/test/units/modules/network/nxos/test_nxos_vpc.py @@ -41,15 +41,14 @@ class TestNxosVpcModule(TestNxosModule): self.mock_load_config.stop() self.mock_run_commands.stop() - def load_fixtures(self, commands=None): + def load_fixtures(self, commands=None, device=''): def load_from_file(*args, **kwargs): module, commands = args output = list() for command in commands: filename = str(command).split(' | ')[0].replace(' ', '_') - filename = os.path.join('nxos_vpc', filename) - output.append(load_fixture(filename)) + output.append(load_fixture('nxos_vpc', filename)) return output self.load_config.return_value = None diff --git a/test/units/modules/network/nxos/test_nxos_vpc_interface.py b/test/units/modules/network/nxos/test_nxos_vpc_interface.py index 413abf0c7ea..3e25ada534e 100644 --- a/test/units/modules/network/nxos/test_nxos_vpc_interface.py +++ b/test/units/modules/network/nxos/test_nxos_vpc_interface.py @@ -45,14 +45,13 @@ class TestNxosVpcModule(TestNxosModule): self.mock_get_config.stop() self.mock_run_commands.stop() - def load_fixtures(self, commands=None): + def load_fixtures(self, commands=None, device=''): def load_from_file(*args, **kwargs): module, commands = args output = list() for command in commands: filename = str(command).split(' | ')[0].replace(' ', '_') - filename = os.path.join('nxos_vpc_interface', filename) - output.append(load_fixture(filename)) + output.append(load_fixture('nxos_vpc_interface', filename)) return output self.run_commands.side_effect = load_from_file diff --git a/test/units/modules/network/nxos/test_nxos_vrf.py b/test/units/modules/network/nxos/test_nxos_vrf.py index 104a2686511..71a984f105d 100644 --- a/test/units/modules/network/nxos/test_nxos_vrf.py +++ b/test/units/modules/network/nxos/test_nxos_vrf.py @@ -41,15 +41,14 @@ class TestNxosVrfModule(TestNxosModule): self.mock_load_config.stop() self.mock_run_commands.stop() - def load_fixtures(self, commands=None): + def load_fixtures(self, commands=None, device=''): def load_from_file(*args, **kwargs): module, commands = args output = list() for command in commands: filename = str(command).split(' | ')[0].replace(' ', '_') - filename = os.path.join('nxos_vrf', filename) - output.append(load_fixture(filename)) + output.append(load_fixture('nxos_vrf', filename)) return output self.load_config.return_value = None diff --git a/test/units/modules/network/nxos/test_nxos_vrf_af.py b/test/units/modules/network/nxos/test_nxos_vrf_af.py index c1841d9557e..d2a890e4e15 100644 --- a/test/units/modules/network/nxos/test_nxos_vrf_af.py +++ b/test/units/modules/network/nxos/test_nxos_vrf_af.py @@ -44,7 +44,7 @@ class TestNxosVrfafModule(TestNxosModule): self.mock_load_config.stop() self.mock_get_config.stop() - def load_fixtures(self, commands=None): + def load_fixtures(self, commands=None, device=''): self.load_config.return_value = None def test_nxos_vrf_af_present(self): diff --git a/test/units/modules/network/nxos/test_nxos_vxlan_vtep.py b/test/units/modules/network/nxos/test_nxos_vxlan_vtep.py index bfe0f20c0c8..db6fa11d787 100644 --- a/test/units/modules/network/nxos/test_nxos_vxlan_vtep.py +++ b/test/units/modules/network/nxos/test_nxos_vxlan_vtep.py @@ -42,7 +42,7 @@ class TestNxosVxlanVtepVniModule(TestNxosModule): self.mock_load_config.stop() def load_fixtures(self, commands=None, device=''): - self.get_config.return_value = load_fixture('nxos_vxlan_vtep/config.cfg') + self.get_config.return_value = load_fixture('nxos_vxlan_vtep', 'config.cfg') self.load_config.return_value = None def test_nxos_vxlan_vtep(self):