2018-06-07 10:00:50 +02:00
|
|
|
"""
|
|
|
|
Helpers for testing.
|
|
|
|
"""
|
2017-12-30 16:30:35 +01:00
|
|
|
|
2017-04-15 14:46:22 +02:00
|
|
|
|
|
|
|
class MockResponse:
|
2017-04-18 16:16:24 +02:00
|
|
|
def __init__(self, response_data={}, ok=True, is_redirect=False):
|
2017-04-15 14:46:22 +02:00
|
|
|
self.response_data = response_data
|
2018-01-02 10:44:32 +01:00
|
|
|
self.content = response_data
|
2017-04-18 16:16:24 +02:00
|
|
|
self.ok = ok
|
|
|
|
self.is_redirect = is_redirect
|
2017-04-15 14:46:22 +02:00
|
|
|
|
|
|
|
def raise_for_status(self):
|
|
|
|
pass
|
|
|
|
|
|
|
|
def json(self):
|
|
|
|
return self.response_data
|
2017-12-30 12:52:55 +01:00
|
|
|
|
|
|
|
|
|
|
|
def retval(val):
|
|
|
|
return lambda *args, **kwargs: val
|