add config option to replace argument (#34342)

Signed-off-by: Trishna Guha <trishnaguha17@gmail.com>
This commit is contained in:
Trishna Guha 2018-01-15 21:17:02 +05:30 committed by GitHub
commit a65f702155
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 55 additions and 8 deletions

View file

@ -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)