mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-07-22 12:50:22 -07:00
add config option to replace argument (#34342)
Signed-off-by: Trishna Guha <trishnaguha17@gmail.com>
This commit is contained in:
parent
179012caf3
commit
a65f702155
2 changed files with 55 additions and 8 deletions
|
@ -39,10 +39,15 @@ 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'}}
|
||||
|
||||
def tearDown(self):
|
||||
super(TestNxosConfigModule, self).tearDown()
|
||||
self.mock_get_config.stop()
|
||||
self.mock_load_config.stop()
|
||||
self.mock_get_capabilities.stop()
|
||||
|
||||
def load_fixtures(self, commands=None, device=''):
|
||||
self.get_config.return_value = load_fixture('nxos_config', 'config.cfg')
|
||||
|
@ -63,6 +68,11 @@ 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'))
|
||||
result = self.execute_module(changed=True)
|
||||
self.assertEqual(result['commands'], ['config replace config.txt'])
|
||||
|
||||
def test_nxos_config_lines(self):
|
||||
args = dict(lines=['hostname switch01', 'ip domain-name eng.ansible.com'])
|
||||
set_module_args(args)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue