|
|
|
@ -38,10 +38,6 @@ class TestNxosConfigModule(TestNxosModule):
|
|
|
|
|
self.mock_load_config = patch('ansible.modules.network.nxos.nxos_config.load_config')
|
|
|
|
|
self.load_config = self.mock_load_config.start()
|
|
|
|
|
|
|
|
|
|
self.mock_get_capabilities = patch('ansible.modules.network.nxos.nxos_config.get_capabilities')
|
|
|
|
|
self.get_capabilities = self.mock_get_capabilities.start()
|
|
|
|
|
self.get_capabilities.return_value = {'device_info': {'network_os_platform': 'N9K-NXOSV'}}
|
|
|
|
|
|
|
|
|
|
self.mock_save_config = patch('ansible.modules.network.nxos.nxos_config.save_config')
|
|
|
|
|
self.save_config = self.mock_save_config.start()
|
|
|
|
|
|
|
|
|
@ -61,7 +57,6 @@ class TestNxosConfigModule(TestNxosModule):
|
|
|
|
|
super(TestNxosConfigModule, self).tearDown()
|
|
|
|
|
self.mock_get_config.stop()
|
|
|
|
|
self.mock_load_config.stop()
|
|
|
|
|
self.mock_get_capabilities.stop()
|
|
|
|
|
self.mock_run_commands.stop()
|
|
|
|
|
self.mock_get_connection.stop()
|
|
|
|
|
|
|
|
|
@ -89,10 +84,10 @@ class TestNxosConfigModule(TestNxosModule):
|
|
|
|
|
self.assertEqual(sorted(config), sorted(result['commands']), result['commands'])
|
|
|
|
|
|
|
|
|
|
def test_nxos_config_replace_src(self):
|
|
|
|
|
set_module_args(dict(replace_src='config.txt', replace='config'))
|
|
|
|
|
set_module_args(dict(replace_src='bootflash:config', replace='config'))
|
|
|
|
|
self.conn.get_diff = MagicMock(return_value=self.cliconf_obj.get_diff(self.running_config, self.running_config, diff_replace='config'))
|
|
|
|
|
result = self.execute_module(changed=True)
|
|
|
|
|
self.assertEqual(result['commands'], ['config replace config.txt'])
|
|
|
|
|
self.assertEqual(result['commands'], ['config replace bootflash:config'])
|
|
|
|
|
|
|
|
|
|
def test_nxos_config_lines(self):
|
|
|
|
|
lines = ['hostname switch01', 'ip domain-name eng.ansible.com']
|
|
|
|
|