Esempio n. 1
0
 def test_match_string_context_propagation_exception(self):
     try:
         context_propagation.match_string_context_propagation(
             device=self.mocked_obj)
     except Exception as err:
         self.assertEqual(err.args[0],
                          "context_id and value are mandatory argument")
Esempio n. 2
0
    def test_match_string_context_propagation_failure_no_count(self):
        lst = [
            Response(
                "pctxt_id : string => [555=>[0818] T26 JDPI-TEST: MAIL(4)][0819]"
            )
        ]
        self.mocked_obj.get_srx_pfe_names = MagicMock(return_value=["fpc0"])
        self.mocked_obj.vty = MagicMock(side_effect=lst)

        try:
            context_propagation.match_string_context_propagation(
                device=self.mocked_obj,
                cntx_id="555",
                length="4",
                value="ehlo")
        except Exception as err:
            self.assertEqual(err.args[0], "ehlo pattern not found in trace")
Esempio n. 3
0
 def test_match_string_context_propagation_success_with_trace(self):
     trace = "pctxt_id : string => [555=>[0818] T26 JDPI-TEST: EHLO(4)][0819]"
     self.assertEqual(
         context_propagation.match_string_context_propagation(
             device=self.mocked_obj,
             cntx_id="555",
             length="4",
             value="ehlo",
             count="1",
             trace=trace), True)
Esempio n. 4
0
 def test_match_string_context_propagation_success_with_no_length(self):
     lst = [
         Response(
             "pctxt_id : string => [555=>[0818] T26 JDPI-TEST: EHLO(4)][0819]"
         )
     ]
     self.mocked_obj.get_srx_pfe_names = MagicMock(return_value=["fpc0"])
     self.mocked_obj.vty = MagicMock(side_effect=lst)
     self.assertEqual(
         context_propagation.match_string_context_propagation(
             device=self.mocked_obj, cntx_id="555", value="ehlo",
             count="1"), True)
Esempio n. 5
0
 def test_match_string_context_propagation_exception_no_device(self):
     try:
         context_propagation.match_string_context_propagation()
     except Exception as err:
         self.assertEqual(err.args[0], "device is mandatory argument")