summary refs log tree commit diff
path: root/tests/rest/test_rooms.py
diff options
context:
space:
mode:
authorKegan Dougal <kegan@matrix.org>2014-08-26 17:21:48 +0100
committerKegan Dougal <kegan@matrix.org>2014-08-26 17:21:48 +0100
commit5a93bfe1f03bf225bcf3b14089faefa3b5715499 (patch)
tree8fdd0868de29108aa3de5a9bb524b516c343e326 /tests/rest/test_rooms.py
parentAdded RoomSendEventRestServlet to send generic non-state events. It even appe... (diff)
downloadsynapse-5a93bfe1f03bf225bcf3b14089faefa3b5715499.tar.xz
Removed MessageRestServlet, use RoomSendEventRestServlet instead. Updated cmdclient, tests and webclient. All appears to work.
Diffstat (limited to 'tests/rest/test_rooms.py')
-rw-r--r--tests/rest/test_rooms.py35
1 files changed, 12 insertions, 23 deletions
diff --git a/tests/rest/test_rooms.py b/tests/rest/test_rooms.py
index 8514d6ba21..f18c506a7d 100644
--- a/tests/rest/test_rooms.py
+++ b/tests/rest/test_rooms.py
@@ -83,8 +83,8 @@ class RoomPermissionsTestCase(RestTestCase):
                                   is_public=True)
 
         # send a message in one of the rooms
-        self.created_rmid_msg_path = ("/rooms/%s/messages/%s/midaaa1" %
-                                (self.created_rmid, self.rmcreator_id))
+        self.created_rmid_msg_path = ("/rooms/%s/send/m.room.message/a1" %
+                                (self.created_rmid))
         (code, response) = yield self.mock_resource.trigger(
                            "PUT",
                            self.created_rmid_msg_path,
@@ -138,14 +138,14 @@ class RoomPermissionsTestCase(RestTestCase):
     @defer.inlineCallbacks
     def test_send_message(self):
         msg_content = '{"msgtype":"m.text","body":"hello"}'
-        send_msg_path = ("/rooms/%s/messages/%s/mid1" %
-                        (self.created_rmid, self.user_id))
+        send_msg_path = ("/rooms/%s/send/m.room.message/mid1" %
+                        (self.created_rmid))
 
         # send message in uncreated room, expect 403
         (code, response) = yield self.mock_resource.trigger(
                            "PUT",
-                           "/rooms/%s/messages/%s/mid1" %
-                           (self.uncreated_rmid, self.user_id), msg_content)
+                           "/rooms/%s/send/m.room.message/mid2" %
+                           (self.uncreated_rmid), msg_content)
         self.assertEquals(403, code, msg=str(response))
 
         # send message in created room not joined (no state), expect 403
@@ -875,9 +875,8 @@ class RoomMessagesTestCase(RestTestCase):
 
     @defer.inlineCallbacks
     def test_invalid_puts(self):
-        path = "/rooms/%s/messages/%s/mid1" % (
-            urllib.quote(self.room_id), self.user_id
-        )
+        path = "/rooms/%s/send/m.room.message/mid1" % (
+            urllib.quote(self.room_id))
         # missing keys or invalid json
         (code, response) = yield self.mock_resource.trigger("PUT",
                            path, '{}')
@@ -905,9 +904,8 @@ class RoomMessagesTestCase(RestTestCase):
 
     @defer.inlineCallbacks
     def test_rooms_messages_sent(self):
-        path = "/rooms/%s/messages/%s/mid1" % (
-            urllib.quote(self.room_id), self.user_id
-        )
+        path = "/rooms/%s/send/m.room.message/mid1" % (
+            urllib.quote(self.room_id))
 
         content = '{"body":"test","msgtype":{"type":"a"}}'
         (code, response) = yield self.mock_resource.trigger("PUT", path, content)
@@ -923,9 +921,8 @@ class RoomMessagesTestCase(RestTestCase):
 #        self.assert_dict(json.loads(content), response)
 
         # m.text message type
-        path = "/rooms/%s/messages/%s/mid2" % (
-            urllib.quote(self.room_id), self.user_id
-        )
+        path = "/rooms/%s/send/m.room.message/mid2" % (
+            urllib.quote(self.room_id))
         content = '{"body":"test2","msgtype":"m.text"}'
         (code, response) = yield self.mock_resource.trigger("PUT", path, content)
         self.assertEquals(200, code, msg=str(response))
@@ -933,11 +930,3 @@ class RoomMessagesTestCase(RestTestCase):
 #        (code, response) = yield self.mock_resource.trigger("GET", path, None)
 #        self.assertEquals(200, code, msg=str(response))
 #        self.assert_dict(json.loads(content), response)
-
-        # trying to send message in different user path
-        path = "/rooms/%s/messages/%s/mid2" % (
-            urllib.quote(self.room_id), "invalid" + self.user_id
-        )
-        content = '{"body":"test2","msgtype":"m.text"}'
-        (code, response) = yield self.mock_resource.trigger("PUT", path, content)
-        self.assertEquals(403, code, msg=str(response))