예제 #1
0
 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
예제 #2
0
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."
예제 #3
0
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
예제 #4
0
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."
예제 #5
0
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
예제 #6
0
 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