diff options
author | drebs <drebs@leap.se> | 2013-01-10 15:39:42 -0200 |
---|---|---|
committer | drebs <drebs@leap.se> | 2013-01-10 15:39:42 -0200 |
commit | 17c3c2d2d18abac6f63f82beed9ccc875f2b16af (patch) | |
tree | 3cc2228189458cf91eeffe6440e746b9a49ec4b6 /src | |
parent | bb4d7cff049243856231afc207734af7edaabbae (diff) |
LeapDatabase passes u1db TestHTTPDatabaseSimpleOperations.
Diffstat (limited to 'src')
-rw-r--r-- | src/leap/soledad/tests/test_leap_backend.py | 35 |
1 files changed, 33 insertions, 2 deletions
diff --git a/src/leap/soledad/tests/test_leap_backend.py b/src/leap/soledad/tests/test_leap_backend.py index 4491fe86..1759faad 100644 --- a/src/leap/soledad/tests/test_leap_backend.py +++ b/src/leap/soledad/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 |