summary refs log tree commit diff
path: root/tests/rest
diff options
context:
space:
mode:
authorMark Haines <mark.haines@matrix.org>2014-09-30 17:55:06 +0100
committerMark Haines <mark.haines@matrix.org>2014-09-30 17:55:06 +0100
commit9605593d11b67199a98ed25f121a2af2e1c9587a (patch)
treedc57897bfcbd1591fa0dfb219e376353584654e9 /tests/rest
parentSYN-75 Verify signatures on server to server transactions (diff)
parentpyflakes cleanup (diff)
downloadsynapse-9605593d11b67199a98ed25f121a2af2e1c9587a.tar.xz
Merge branch 'develop' into server2server_signing
Conflicts:
	synapse/storage/__init__.py
	tests/rest/test_presence.py
Diffstat (limited to 'tests/rest')
-rw-r--r--tests/rest/test_presence.py14
-rw-r--r--tests/rest/test_profile.py4
-rw-r--r--tests/rest/test_rooms.py41
3 files changed, 49 insertions, 10 deletions
diff --git a/tests/rest/test_presence.py b/tests/rest/test_presence.py
index 20fd179003..769c7824bc 100644
--- a/tests/rest/test_presence.py
+++ b/tests/rest/test_presence.py
@@ -52,6 +52,7 @@ class PresenceStateTestCase(unittest.TestCase):
             datastore=Mock(spec=[
                 "get_presence_state",
                 "set_presence_state",
+                "insert_client_ip",
             ]),
             http_client=None,
             resource_for_client=self.mock_resource,
@@ -67,7 +68,11 @@ class PresenceStateTestCase(unittest.TestCase):
         self.datastore.get_presence_list = get_presence_list
 
         def _get_user_by_token(token=None):
-            return hs.parse_userid(myid)
+            return {
+                "user": hs.parse_userid(myid),
+                "admin": False,
+                "device_id": None,
+            }
 
         hs.get_auth().get_user_by_token = _get_user_by_token
 
@@ -135,6 +140,7 @@ class PresenceListTestCase(unittest.TestCase):
                 "set_presence_list_accepted",
                 "del_presence_list",
                 "get_presence_list",
+                "insert_client_ip",
             ]),
             http_client=None,
             resource_for_client=self.mock_resource,
@@ -152,7 +158,11 @@ class PresenceListTestCase(unittest.TestCase):
         self.datastore.has_presence_state = has_presence_state
 
         def _get_user_by_token(token=None):
-            return hs.parse_userid(myid)
+            return {
+                "user": hs.parse_userid(myid),
+                "admin": False,
+                "device_id": None,
+            }
 
         room_member_handler = hs.handlers.room_member_handler = Mock(
             spec=[
diff --git a/tests/rest/test_profile.py b/tests/rest/test_profile.py
index e6e51f6dd0..b0f48e7fd8 100644
--- a/tests/rest/test_profile.py
+++ b/tests/rest/test_profile.py
@@ -50,10 +50,10 @@ class ProfileTestCase(unittest.TestCase):
             datastore=None,
         )
 
-        def _get_user_by_token(token=None):
+        def _get_user_by_req(request=None):
             return hs.parse_userid(myid)
 
-        hs.get_auth().get_user_by_token = _get_user_by_token
+        hs.get_auth().get_user_by_req = _get_user_by_req
 
         hs.get_handlers().profile_handler = self.mock_handler
 
diff --git a/tests/rest/test_rooms.py b/tests/rest/test_rooms.py
index 4ea5828d4f..1ce9b8a83d 100644
--- a/tests/rest/test_rooms.py
+++ b/tests/rest/test_rooms.py
@@ -69,7 +69,11 @@ class RoomPermissionsTestCase(RestTestCase):
         hs.get_handlers().federation_handler = Mock()
 
         def _get_user_by_token(token=None):
-            return hs.parse_userid(self.auth_user_id)
+            return {
+                "user": hs.parse_userid(self.auth_user_id),
+                "admin": False,
+                "device_id": None,
+            }
         hs.get_auth().get_user_by_token = _get_user_by_token
 
         self.auth_user_id = self.rmcreator_id
@@ -425,7 +429,11 @@ class RoomsMemberListTestCase(RestTestCase):
         self.auth_user_id = self.user_id
 
         def _get_user_by_token(token=None):
-            return hs.parse_userid(self.auth_user_id)
+            return {
+                "user": hs.parse_userid(self.auth_user_id),
+                "admin": False,
+                "device_id": None,
+            }
         hs.get_auth().get_user_by_token = _get_user_by_token
 
         synapse.rest.room.register_servlets(hs, self.mock_resource)
@@ -508,7 +516,11 @@ class RoomsCreateTestCase(RestTestCase):
         hs.get_handlers().federation_handler = Mock()
 
         def _get_user_by_token(token=None):
-            return hs.parse_userid(self.auth_user_id)
+            return {
+                "user": hs.parse_userid(self.auth_user_id),
+                "admin": False,
+                "device_id": None,
+            }
         hs.get_auth().get_user_by_token = _get_user_by_token
 
         synapse.rest.room.register_servlets(hs, self.mock_resource)
@@ -605,7 +617,11 @@ class RoomTopicTestCase(RestTestCase):
         hs.get_handlers().federation_handler = Mock()
 
         def _get_user_by_token(token=None):
-            return hs.parse_userid(self.auth_user_id)
+            return {
+                "user": hs.parse_userid(self.auth_user_id),
+                "admin": False,
+                "device_id": None,
+            }
         hs.get_auth().get_user_by_token = _get_user_by_token
 
         synapse.rest.room.register_servlets(hs, self.mock_resource)
@@ -715,7 +731,16 @@ class RoomMemberStateTestCase(RestTestCase):
         hs.get_handlers().federation_handler = Mock()
 
         def _get_user_by_token(token=None):
-            return hs.parse_userid(self.auth_user_id)
+            return {
+                "user": hs.parse_userid(self.auth_user_id),
+                "admin": False,
+                "device_id": None,
+            }
+            return {
+                "user": hs.parse_userid(self.auth_user_id),
+                "admin": False,
+                "device_id": None,
+            }
         hs.get_auth().get_user_by_token = _get_user_by_token
 
         synapse.rest.room.register_servlets(hs, self.mock_resource)
@@ -847,7 +872,11 @@ class RoomMessagesTestCase(RestTestCase):
         hs.get_handlers().federation_handler = Mock()
 
         def _get_user_by_token(token=None):
-            return hs.parse_userid(self.auth_user_id)
+            return {
+                "user": hs.parse_userid(self.auth_user_id),
+                "admin": False,
+                "device_id": None,
+            }
         hs.get_auth().get_user_by_token = _get_user_by_token
 
         synapse.rest.room.register_servlets(hs, self.mock_resource)