def __init__(self, request_data=None, request_handler=None): """Setup call with provided request data and handler.""" self.request_data = request_data or {} # data for the request self.request_handler = request_handler or \ get_default_request_handler() # handler to fullfil the request self.response_data = None # response data is stored here self.cleaned = None # cleaned response data is stored here
def test_raise_exception_if_no_default_handler_is_set(): with pytest.raises(Exception) as e: get_default_request_handler() assert str(e.value) == "Request handler required but no default was found."
def test_get_set_default_handler(): h = RequestHandler('') set_default_request_handler(h) assert get_default_request_handler() == h ubersmith.api._DEFAULT_REQUEST_HANDLER = None
def __init__(self, request_data=None, request_handler=None): """Setup call with provided request data and handler.""" self.request_data = request_data or {} # data for the request self.request_handler = request_handler or \ get_default_request_handler() # handler to fullfil the request self.response = None # response is stored here