def test_match_integer_context_propagation_execption(self): try: context_propagation.match_integer_context_propagation( device=self.mocked_obj) except Exception as err: self.assertEqual(err.args[0], "context_id and value are mandatory argument")
def test_match_integer_context_propagation_failure_no_count(self): lst = [Response("pctxt_id : signed 32 bit data => [872=>699]")] self.mocked_obj.get_srx_pfe_names = MagicMock(return_value=["fpc0"]) self.mocked_obj.vty = MagicMock(side_effect=lst) try: context_propagation.match_integer_context_propagation( device=self.mocked_obj, cntx_id="872", value="700") except Exception as err: self.assertEqual(err.args[0], "700 pattern not found in trace")
def test_match_integer_context_propagation_failure_with_count(self): lst = [Response("pctxt_id : signed 32 bit data => [872=>699]")] self.mocked_obj.get_srx_pfe_names = MagicMock(return_value=["fpc0"]) self.mocked_obj.vty = MagicMock(side_effect=lst) try: context_propagation.match_integer_context_propagation( device=self.mocked_obj, cntx_id="872", value="699", count="2") except Exception as err: self.assertEqual(err.args[0], "Context not propgated as per expectation")
def test_match_integer_context_propagation_success_no_count(self): lst = [Response("pctxt_id : signed 32 bit data => [872=>699]")] self.mocked_obj.get_srx_pfe_names = MagicMock(return_value=["fpc0"]) self.mocked_obj.vty = MagicMock(side_effect=lst) self.assertEqual( context_propagation.match_integer_context_propagation( device=self.mocked_obj, cntx_id="872", value="699"), True)
def test_match_integer_context_propagation_success_with_trace(self): trace = "pctxt_id : signed 32 bit data => [872=>699]" self.assertEqual( context_propagation.match_integer_context_propagation( device=self.mocked_obj, cntx_id="872", value="699", count="1", trace=trace), True)
def test_match_integer_context_propagation_exception(self): try: context_propagation.match_integer_context_propagation() except Exception as err: self.assertEqual(err.args[0], "device is mandatory argument")