def test_add_request_handler_chain_throw_error_for_null_chain(self): test_request_mapper = RequestMapper(request_handler_chains=None) with self.assertRaises(DispatchException) as exc: test_request_mapper.add_request_handler_chain(None) assert "Request Handler Chain is not a RequestHandlerChain instance" in str(exc.exception), ( "Request Mapper didn't throw error during " "add_request_handler_chain method call when " "a Null Handler Chain is passed")
def test_add_request_handler_chain_for_valid_chain_type(self): test_request_handler = mock.MagicMock(spec=AbstractRequestHandler) test_request_handler_chain = RequestHandlerChain( request_handler=test_request_handler) test_request_mapper = RequestMapper(request_handler_chains=None) test_request_mapper.add_request_handler_chain( test_request_handler_chain) assert test_request_mapper.request_handler_chains == [ test_request_handler_chain ], ("Default Request Mapper throws exception when a valid Handler " "Chain is provided in the " "add_request_handler_chain method")