Exemplo n.º 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
Exemplo n.º 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."
Exemplo n.º 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
Exemplo n.º 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."
Exemplo n.º 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
Exemplo n.º 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