def test_replace_no_match(self): """UT: nxos module:replace method - no match""" old_value = "feature does_not_exist" new_value = "feature ospf" with patch( "salt.modules.nxos.show_run", autospec=True, return_value=n9k_show_running_config_list[0], ): with patch("salt.modules.nxos.delete_config", autospec=True, return_value=None): with patch("salt.modules.nxos.add_config", autospec=True, return_value=None): result = nxos_module.replace(old_value, new_value) self.assertEqual(result["old"], []) self.assertEqual(result["new"], [])
def test_replace_full_match_true(self): """ UT: nxos module:replace method - full match true""" old_value = "feature bgp" new_value = "feature ospf" with patch( "salt.modules.nxos.show_run", autospec=True, return_value=n9k_show_running_config_list[0], ): with patch( "salt.modules.nxos.delete_config", autospec=True, return_value=None ): with patch( "salt.modules.nxos.add_config", autospec=True, return_value=None ): result = nxos_module.replace(old_value, new_value, full_match=True) self.assertEqual(result["old"], ["feature bgp"]) self.assertEqual(result["new"], ["feature ospf"])