diff options
author | Erik Johnston <erik@matrix.org> | 2014-09-17 15:05:09 +0100 |
---|---|---|
committer | Erik Johnston <erik@matrix.org> | 2014-09-17 15:05:14 +0100 |
commit | b6818fd4d2108543ce86b5d8bf540e74a89cf27e (patch) | |
tree | 3b62ea9a09f0cfd2afe4bb238479bcd554af47da /tests/handlers/test_profile.py | |
parent | BF: edit the actual room name not the displayed room name (which has been com... (diff) | |
download | synapse-b6818fd4d2108543ce86b5d8bf540e74a89cf27e.tar.xz |
SYN-40: When a user updates their displayname or avatar update all their join events for all the rooms they are currently in.
Diffstat (limited to '')
-rw-r--r-- | tests/handlers/test_profile.py | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/tests/handlers/test_profile.py b/tests/handlers/test_profile.py index 0a5cebb4cc..ee2be9b6d5 100644 --- a/tests/handlers/test_profile.py +++ b/tests/handlers/test_profile.py @@ -22,6 +22,7 @@ from mock import Mock from synapse.api.errors import AuthError from synapse.server import HomeServer from synapse.handlers.profile import ProfileHandler +from synapse.api.constants import Membership class ProfileHandlers(object): @@ -50,6 +51,7 @@ class ProfileTestCase(unittest.TestCase): "set_profile_displayname", "get_profile_avatar_url", "set_profile_avatar_url", + "get_rooms_for_user_where_membership_is", ]), handlers=None, resource_for_federation=Mock(), @@ -65,6 +67,10 @@ class ProfileTestCase(unittest.TestCase): self.handler = hs.get_handlers().profile_handler + self.mock_get_joined = ( + self.datastore.get_rooms_for_user_where_membership_is + ) + # TODO(paul): Icky signal declarings.. booo hs.get_distributor().declare("changed_presencelike_data") @@ -83,8 +89,15 @@ class ProfileTestCase(unittest.TestCase): mocked_set = self.datastore.set_profile_displayname mocked_set.return_value = defer.succeed(()) + self.mock_get_joined.return_value = defer.succeed([]) + yield self.handler.set_displayname(self.frank, self.frank, "Frank Jr.") + self.mock_get_joined.assert_called_once_with( + self.frank.to_string(), + [Membership.JOIN] + ) + mocked_set.assert_called_with("1234ABCD", "Frank Jr.") @defer.inlineCallbacks @@ -135,7 +148,15 @@ class ProfileTestCase(unittest.TestCase): mocked_set = self.datastore.set_profile_avatar_url mocked_set.return_value = defer.succeed(()) + self.mock_get_joined.return_value = defer.succeed([]) + yield self.handler.set_avatar_url(self.frank, self.frank, "http://my.server/pic.gif") + self.mock_get_joined.assert_called_once_with( + self.frank.to_string(), + [Membership.JOIN] + ) + + mocked_set.assert_called_with("1234ABCD", "http://my.server/pic.gif") |