diff options
author | Hubert Chathi <hubert@uhoreg.ca> | 2019-10-25 10:42:07 -0400 |
---|---|---|
committer | Hubert Chathi <hubert@uhoreg.ca> | 2019-10-25 10:42:07 -0400 |
commit | 4cf3a30a20c64c3939135b00b3eb5b06f273c9f9 (patch) | |
tree | 65ee77d80e8a93cd11b6e8ad92dd500974e87573 /tests | |
parent | remove some unnecessary lines (diff) | |
download | synapse-4cf3a30a20c64c3939135b00b3eb5b06f273c9f9.tar.xz |
switch to using HomeserverTestCase
Diffstat (limited to 'tests')
-rw-r--r-- | tests/storage/test_e2e_room_keys.py | 44 |
1 files changed, 25 insertions, 19 deletions
diff --git a/tests/storage/test_e2e_room_keys.py b/tests/storage/test_e2e_room_keys.py index 6658dbda94..9935ac59ce 100644 --- a/tests/storage/test_e2e_room_keys.py +++ b/tests/storage/test_e2e_room_keys.py @@ -26,46 +26,52 @@ room_key = { } -class E2eRoomKeysHandlerTestCase(unittest.TestCase): - @defer.inlineCallbacks - def setUp(self): - hs = yield utils.setup_test_homeserver(self.addCleanup) - +class E2eRoomKeysHandlerTestCase(unittest.HomeserverTestCase): + def make_homeserver(self, reactor, clock): + hs = self.setup_test_homeserver("server", http_client=None) self.store = hs.get_datastore() + return hs - @defer.inlineCallbacks def test_room_keys_version_delete(self): # test that deleting a room key backup deletes the keys - version1 = yield self.store.create_e2e_room_keys_version( - "user_id", {"algorithm": "rot13", "auth_data": {}} + version1 = self.get_success( + self.store.create_e2e_room_keys_version( + "user_id", {"algorithm": "rot13", "auth_data": {}} + ) ) - yield self.store.set_e2e_room_key( - "user_id", version1, "room", "session", room_key + self.get_success( + self.store.set_e2e_room_key( + "user_id", version1, "room", "session", room_key + ) ) - version2 = yield self.store.create_e2e_room_keys_version( - "user_id", {"algorithm": "rot13", "auth_data": {}} + version2 = self.get_success( + self.store.create_e2e_room_keys_version( + "user_id", {"algorithm": "rot13", "auth_data": {}} + ) ) - yield self.store.set_e2e_room_key( - "user_id", version2, "room", "session", room_key + self.get_success( + self.store.set_e2e_room_key( + "user_id", version2, "room", "session", room_key + ) ) # make sure the keys were stored properly - keys = yield self.store.get_e2e_room_keys("user_id", version1) + keys = self.get_success(self.store.get_e2e_room_keys("user_id", version1)) self.assertEqual(len(keys["rooms"]), 1) - keys = yield self.store.get_e2e_room_keys("user_id", version2) + keys = self.get_success(self.store.get_e2e_room_keys("user_id", version2)) self.assertEqual(len(keys["rooms"]), 1) # delete version1 - yield self.store.delete_e2e_room_keys_version("user_id", version1) + self.get_success(self.store.delete_e2e_room_keys_version("user_id", version1)) # make sure the key from version1 is gone, and the key from version2 is # still there - keys = yield self.store.get_e2e_room_keys("user_id", version1) + keys = self.get_success(self.store.get_e2e_room_keys("user_id", version1)) self.assertEqual(len(keys["rooms"]), 0) - keys = yield self.store.get_e2e_room_keys("user_id", version2) + keys = self.get_success(self.store.get_e2e_room_keys("user_id", version2)) self.assertEqual(len(keys["rooms"]), 1) |