Convert directory, e2e_room_keys, end_to_end_keys, monthly_active_users database to async (#8042)

This commit is contained in:
Patrick Cloke 2020-08-07 13:36:29 -04:00 committed by GitHub
parent f3fe6961b2
commit 7f837959ea
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
10 changed files with 141 additions and 120 deletions

View file

@ -34,8 +34,10 @@ class DirectoryStoreTestCase(unittest.TestCase):
@defer.inlineCallbacks
def test_room_to_alias(self):
yield self.store.create_room_alias_association(
room_alias=self.alias, room_id=self.room.to_string(), servers=["test"]
yield defer.ensureDeferred(
self.store.create_room_alias_association(
room_alias=self.alias, room_id=self.room.to_string(), servers=["test"]
)
)
self.assertEquals(
@ -45,24 +47,36 @@ class DirectoryStoreTestCase(unittest.TestCase):
@defer.inlineCallbacks
def test_alias_to_room(self):
yield self.store.create_room_alias_association(
room_alias=self.alias, room_id=self.room.to_string(), servers=["test"]
yield defer.ensureDeferred(
self.store.create_room_alias_association(
room_alias=self.alias, room_id=self.room.to_string(), servers=["test"]
)
)
self.assertObjectHasAttributes(
{"room_id": self.room.to_string(), "servers": ["test"]},
(yield self.store.get_association_from_room_alias(self.alias)),
(
yield defer.ensureDeferred(
self.store.get_association_from_room_alias(self.alias)
)
),
)
@defer.inlineCallbacks
def test_delete_alias(self):
yield self.store.create_room_alias_association(
room_alias=self.alias, room_id=self.room.to_string(), servers=["test"]
yield defer.ensureDeferred(
self.store.create_room_alias_association(
room_alias=self.alias, room_id=self.room.to_string(), servers=["test"]
)
)
room_id = yield self.store.delete_room_alias(self.alias)
room_id = yield defer.ensureDeferred(self.store.delete_room_alias(self.alias))
self.assertEqual(self.room.to_string(), room_id)
self.assertIsNone(
(yield self.store.get_association_from_room_alias(self.alias))
(
yield defer.ensureDeferred(
self.store.get_association_from_room_alias(self.alias)
)
)
)