コード例 #1
0
    def test_find_single_match(self):
        """UT: nxos module:test_find method - Find single match in running config"""

        find_pattern = "^vrf context testing$"
        find_string = "vrf context testing"

        with patch("salt.modules.nxos.show_run",
                   return_value=n9k_running_config,
                   autospec=True):
            result = nxos_module.find(find_pattern)
            self.assertIn(find_string, result)
コード例 #2
0
    def test_find_multiple_matches(self):
        """UT: nxos module:test_find method - Find multiple matches in running config"""

        find_pattern = "^no logging.*$"
        find_string = "no logging event link-status enable"

        with patch("salt.modules.nxos.show_run",
                   return_value=n9k_running_config,
                   autospec=True):
            result = nxos_module.find(find_pattern)
            self.assertIn(find_string, result)
            self.assertEqual(len(result), 7)