Mock ratelimiter to make tests pass.

This commit is contained in:
Kegan Dougal 2014-12-19 17:49:39 +00:00
parent 2a5b53bc4a
commit 4640239d34
2 changed files with 16 additions and 4 deletions

View File

@ -19,7 +19,7 @@ presence and profiles; namely, the displayname and avatar_url."""
from tests import unittest
from twisted.internet import defer
from mock import Mock, call, ANY
from mock import Mock, call, ANY, NonCallableMock
from ..utils import MockClock, MockKey
@ -75,8 +75,13 @@ class PresenceProfilelikeDataTestCase(unittest.TestCase):
resource_for_federation=Mock(),
http_client=None,
replication_layer=MockReplication(),
config=self.mock_config,
)
ratelimiter=NonCallableMock(spec_set=[
"send_message",
]),
config=self.mock_config
)
self.ratelimiter = hs.get_ratelimiter()
self.ratelimiter.send_message.return_value = (True, 0)
hs.handlers = PresenceAndProfileHandlers(hs)
self.datastore = hs.get_datastore()

View File

@ -17,7 +17,7 @@
from tests import unittest
from twisted.internet import defer
from mock import Mock
from mock import Mock, NonCallableMock
from synapse.api.errors import AuthError
from synapse.server import HomeServer
@ -59,7 +59,14 @@ class ProfileTestCase(unittest.TestCase):
resource_for_federation=Mock(),
replication_layer=self.mock_federation,
config=self.mock_config,
ratelimiter=NonCallableMock(spec_set=[
"send_message",
])
)
self.ratelimiter = hs.get_ratelimiter()
self.ratelimiter.send_message.return_value = (True, 0)
hs.handlers = ProfileHandlers(hs)
self.store = hs.get_datastore()