Skip to content
This repository has been archived by the owner on Apr 26, 2024. It is now read-only.

Commit

Permalink
Do not specify ratelimiters in tests when unnecessary.
Browse files Browse the repository at this point in the history
  • Loading branch information
clokep committed Jun 4, 2020
1 parent c145c81 commit 12b4d47
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 21 deletions.
3 changes: 1 addition & 2 deletions tests/handlers/test_profile.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
# limitations under the License.


from mock import Mock, NonCallableMock
from mock import Mock

from twisted.internet import defer

Expand Down Expand Up @@ -55,7 +55,6 @@ def register_query_handler(query_type, handler):
federation_client=self.mock_federation,
federation_server=Mock(),
federation_registry=self.mock_registry,
ratelimiter=NonCallableMock(spec_set=["can_do_action"]),
)

self.store = hs.get_datastore()
Expand Down
7 changes: 2 additions & 5 deletions tests/replication/slave/storage/_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,18 +13,15 @@
# See the License for the specific language governing permissions and
# limitations under the License.

from mock import Mock, NonCallableMock
from mock import Mock

from tests.replication._base import BaseStreamTestCase


class BaseSlavedStoreTestCase(BaseStreamTestCase):
def make_homeserver(self, reactor, clock):

hs = self.setup_test_homeserver(
federation_client=Mock(),
ratelimiter=NonCallableMock(spec_set=["can_do_action"]),
)
hs = self.setup_test_homeserver(federation_client=Mock())

return hs

Expand Down
6 changes: 2 additions & 4 deletions tests/rest/client/v1/test_events.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

""" Tests REST events for /events paths."""

from mock import Mock, NonCallableMock
from mock import Mock

import synapse.rest.admin
from synapse.rest.client.v1 import events, login, room
Expand All @@ -40,9 +40,7 @@ def make_homeserver(self, reactor, clock):
config["enable_registration"] = True
config["auto_join_rooms"] = []

hs = self.setup_test_homeserver(
config=config, ratelimiter=NonCallableMock(spec_set=["can_do_action"])
)
hs = self.setup_test_homeserver(config=config)

hs.get_handlers().federation_handler = Mock()

Expand Down
7 changes: 2 additions & 5 deletions tests/rest/client/v1/test_rooms.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@

import json

from mock import Mock, NonCallableMock
from mock import Mock
from six.moves.urllib import parse as urlparse

from twisted.internet import defer
Expand All @@ -46,10 +46,7 @@ class RoomBase(unittest.HomeserverTestCase):
def make_homeserver(self, reactor, clock):

self.hs = self.setup_test_homeserver(
"red",
http_client=None,
federation_client=Mock(),
ratelimiter=NonCallableMock(spec_set=["can_do_action"]),
"red", http_client=None, federation_client=Mock(),
)

self.hs.get_federation_handler = Mock(return_value=Mock())
Expand Down
7 changes: 2 additions & 5 deletions tests/rest/client/v1/test_typing.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

"""Tests REST events for /rooms paths."""

from mock import Mock, NonCallableMock
from mock import Mock

from twisted.internet import defer

Expand All @@ -39,10 +39,7 @@ class RoomTypingTestCase(unittest.HomeserverTestCase):
def make_homeserver(self, reactor, clock):

hs = self.setup_test_homeserver(
"red",
http_client=None,
federation_client=Mock(),
ratelimiter=NonCallableMock(spec_set=["can_do_action"]),
"red", http_client=None, federation_client=Mock(),
)

self.event_source = hs.get_event_sources().sources["typing"]
Expand Down

0 comments on commit 12b4d47

Please sign in to comment.