summary refs log tree commit diff
path: root/tests/handlers/test_room.py
diff options
context:
space:
mode:
authorMark Haines <mark.haines@matrix.org>2014-09-03 09:15:22 +0100
committerMark Haines <mark.haines@matrix.org>2014-09-03 09:15:22 +0100
commitcdd8602e746d37803ae734f999478fc84a19f43c (patch)
tree800f1f8bed7f5ea3641a56d56158976c0742bca6 /tests/handlers/test_room.py
parentRaise LimitExceedError when the ratelimiting is throttling requests (diff)
downloadsynapse-cdd8602e746d37803ae734f999478fc84a19f43c.tar.xz
Fix tests to support ratelimiting
Diffstat (limited to 'tests/handlers/test_room.py')
-rw-r--r--tests/handlers/test_room.py13
1 files changed, 13 insertions, 0 deletions
diff --git a/tests/handlers/test_room.py b/tests/handlers/test_room.py
index 219a53c426..4591a5ea58 100644
--- a/tests/handlers/test_room.py
+++ b/tests/handlers/test_room.py
@@ -39,6 +39,10 @@ class RoomMemberHandlerTestCase(unittest.TestCase):
         hs = HomeServer(
             self.hostname,
             db_pool=None,
+            ratelimiter=NonCallableMock(spec_set=[
+                "send_message",
+            ]),
+            config=NonCallableMock(),
             datastore=NonCallableMock(spec_set=[
                 "persist_event",
                 "get_joined_hosts_for_room",
@@ -82,6 +86,8 @@ class RoomMemberHandlerTestCase(unittest.TestCase):
         self.snapshot = Mock()
         self.datastore.snapshot_room.return_value = self.snapshot
 
+        self.ratelimiter = hs.get_ratelimiter()
+        self.ratelimiter.send_message.return_value = (True, 0)
 
     @defer.inlineCallbacks
     def test_invite(self):
@@ -342,6 +348,10 @@ class RoomCreationTest(unittest.TestCase):
             ]),
             auth=NonCallableMock(spec_set=["check"]),
             state_handler=NonCallableMock(spec_set=["handle_new_event"]),
+            ratelimiter=NonCallableMock(spec_set=[
+                "send_message",
+            ]),
+            config=NonCallableMock(),
         )
 
         self.federation = NonCallableMock(spec_set=[
@@ -368,6 +378,9 @@ class RoomCreationTest(unittest.TestCase):
             return defer.succeed([])
         self.datastore.get_joined_hosts_for_room.side_effect = hosts
 
+        self.ratelimiter = hs.get_ratelimiter()
+        self.ratelimiter.send_message.return_value = (True, 0)
+
     @defer.inlineCallbacks
     def test_room_creation(self):
         user_id = "@foo:red"