diff options
Diffstat (limited to 'tests/test_leap_backend.py')
-rw-r--r-- | tests/test_leap_backend.py | 35 |
1 files changed, 33 insertions, 2 deletions
diff --git a/tests/test_leap_backend.py b/tests/test_leap_backend.py index 4491fe86..1759faad 100644 --- a/tests/test_leap_backend.py +++ b/tests/test_leap_backend.py @@ -11,8 +11,9 @@ import testscenarios from leap.soledad.backends import leap_backend from leap.soledad.tests import u1db_tests as tests from leap.soledad.tests.u1db_tests.test_remote_sync_target import make_http_app -from leap.soledad.tests.u1db_tests.test_backends import ( - AllDatabaseTests, +from leap.soledad.tests.u1db_tests.test_backends import AllDatabaseTests +from leap.soledad.tests.u1db_tests.test_http_database import ( + TestHTTPDatabaseSimpleOperations, ) @@ -70,4 +71,34 @@ class LeapTests(AllDatabaseTests): scenarios = LEAP_SCENARIOS +#----------------------------------------------------------------------------- +# The following tests come from `u1db.tests.test_http_client`. +#----------------------------------------------------------------------------- + +class TestLeapDatabaseSimpleOperations(TestHTTPDatabaseSimpleOperations): + + def setUp(self): + super(TestHTTPDatabaseSimpleOperations, self).setUp() + self.db = leap_backend.LeapDatabase('dbase') + self.db._conn = object() # crash if used + self.got = None + self.response_val = None + + def _request(method, url_parts, params=None, body=None, + content_type=None): + self.got = method, url_parts, params, body, content_type + if isinstance(self.response_val, Exception): + raise self.response_val + return self.response_val + + def _request_json(method, url_parts, params=None, body=None, + content_type=None): + self.got = method, url_parts, params, body, content_type + if isinstance(self.response_val, Exception): + raise self.response_val + return self.response_val + + self.db._request = _request + self.db._request_json = _request_json + load_tests = tests.load_with_scenarios |