mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-05-07 05:42:50 +00:00
cliconf refactor eos, nxos fix (#43596)
* cliconf refactor eos and nxos fix Signed-off-by: Trishna Guha <trishnaguha17@gmail.com> * move nxos replace check to plugins Signed-off-by: Trishna Guha <trishnaguha17@gmail.com> * address review comment * fix shippable
This commit is contained in:
@@ -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']
|
||||
|
||||
Reference in New Issue
Block a user