mirror of
https://git.anonymousland.org/anonymousland/synapse-product.git
synced 2024-10-01 08:25:44 -04:00
Neaten more of the storage layer tests with assertObjectHasAttributes; more standardisation on test layout
This commit is contained in:
parent
b588ce920d
commit
bcf5121937
@ -47,9 +47,10 @@ class DirectoryStoreTestCase(unittest.TestCase):
|
|||||||
servers=["test"],
|
servers=["test"],
|
||||||
)
|
)
|
||||||
|
|
||||||
aliases = yield self.store.get_aliases_for_room(self.room.to_string())
|
self.assertEquals(
|
||||||
|
["#my-room:test"],
|
||||||
self.assertEquals(["#my-room:test"], aliases)
|
(yield self.store.get_aliases_for_room(self.room.to_string()))
|
||||||
|
)
|
||||||
|
|
||||||
@defer.inlineCallbacks
|
@defer.inlineCallbacks
|
||||||
def test_alias_to_room(self):
|
def test_alias_to_room(self):
|
||||||
@ -59,9 +60,9 @@ class DirectoryStoreTestCase(unittest.TestCase):
|
|||||||
servers=["test"],
|
servers=["test"],
|
||||||
)
|
)
|
||||||
|
|
||||||
mapping = yield self.store.get_association_from_room_alias(
|
|
||||||
self.alias
|
|
||||||
)
|
|
||||||
|
|
||||||
self.assertEquals(self.room.to_string(), mapping.room_id)
|
self.assertObjectHasAttributes(
|
||||||
self.assertEquals(["test"], mapping.servers)
|
{"room_id": self.room.to_string(),
|
||||||
|
"servers": ["test"]},
|
||||||
|
(yield self.store.get_association_from_room_alias(self.alias))
|
||||||
|
)
|
||||||
|
@ -48,9 +48,10 @@ class ProfileStoreTestCase(unittest.TestCase):
|
|||||||
self.u_frank.localpart, "Frank"
|
self.u_frank.localpart, "Frank"
|
||||||
)
|
)
|
||||||
|
|
||||||
name = yield self.store.get_profile_displayname(self.u_frank.localpart)
|
self.assertEquals(
|
||||||
|
"Frank",
|
||||||
self.assertEquals("Frank", name)
|
(yield self.store.get_profile_displayname(self.u_frank.localpart))
|
||||||
|
)
|
||||||
|
|
||||||
@defer.inlineCallbacks
|
@defer.inlineCallbacks
|
||||||
def test_avatar_url(self):
|
def test_avatar_url(self):
|
||||||
@ -62,6 +63,7 @@ class ProfileStoreTestCase(unittest.TestCase):
|
|||||||
self.u_frank.localpart, "http://my.site/here"
|
self.u_frank.localpart, "http://my.site/here"
|
||||||
)
|
)
|
||||||
|
|
||||||
name = yield self.store.get_profile_avatar_url(self.u_frank.localpart)
|
self.assertEquals(
|
||||||
|
"http://my.site/here",
|
||||||
self.assertEquals("http://my.site/here", name)
|
(yield self.store.get_profile_avatar_url(self.u_frank.localpart))
|
||||||
|
)
|
||||||
|
@ -51,13 +51,11 @@ class RoomStoreTestCase(unittest.TestCase):
|
|||||||
|
|
||||||
@defer.inlineCallbacks
|
@defer.inlineCallbacks
|
||||||
def test_get_room(self):
|
def test_get_room(self):
|
||||||
room = yield self.store.get_room(self.room.to_string())
|
|
||||||
|
|
||||||
self.assertObjectHasAttributes(
|
self.assertObjectHasAttributes(
|
||||||
{"room_id": self.room.to_string(),
|
{"room_id": self.room.to_string(),
|
||||||
"creator": self.u_creator.to_string(),
|
"creator": self.u_creator.to_string(),
|
||||||
"is_public": True},
|
"is_public": True},
|
||||||
room
|
(yield self.store.get_room(self.room.to_string()))
|
||||||
)
|
)
|
||||||
|
|
||||||
@defer.inlineCallbacks
|
@defer.inlineCallbacks
|
||||||
@ -66,9 +64,10 @@ class RoomStoreTestCase(unittest.TestCase):
|
|||||||
visibility=False
|
visibility=False
|
||||||
)
|
)
|
||||||
|
|
||||||
room = yield self.store.get_room(self.room.to_string())
|
self.assertObjectHasAttributes(
|
||||||
|
{"is_public": False},
|
||||||
self.assertFalse(room.is_public)
|
(yield self.store.get_room(self.room.to_string()))
|
||||||
|
)
|
||||||
|
|
||||||
@defer.inlineCallbacks
|
@defer.inlineCallbacks
|
||||||
def test_get_rooms(self):
|
def test_get_rooms(self):
|
||||||
|
Loading…
Reference in New Issue
Block a user