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

Clean-up registration tests #10945

Merged
merged 5 commits into from
Sep 30, 2021
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion synapse/handlers/register.py
Original file line number Diff line number Diff line change
Expand Up @@ -387,7 +387,7 @@ async def _create_and_join_rooms(self, user_id: str) -> None:
"preset": self.hs.config.registration.autocreate_auto_join_room_preset,
}

# If the configuration providers a user ID to create rooms with, use
# If the configuration provides a user ID to create rooms with, use
# that instead of the first user registered.
requires_join = False
if self.hs.config.registration.auto_join_user_id:
Expand Down
20 changes: 15 additions & 5 deletions tests/handlers/test_register.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,12 @@

from synapse.api.auth import Auth
from synapse.api.constants import UserTypes
from synapse.api.errors import Codes, ResourceLimitError, SynapseError
from synapse.api.errors import (
CodeMessageException,
Codes,
ResourceLimitError,
SynapseError,
)
from synapse.events.spamcheck import load_legacy_spam_checkers
from synapse.spam_checker_api import RegistrationBehaviour
from synapse.types import RoomAlias, RoomID, UserID, create_requester
Expand Down Expand Up @@ -127,7 +132,15 @@ def make_homeserver(self, reactor, clock):
hs_config["max_mau_value"] = 50
hs_config["limit_usage_by_mau"] = True

hs = self.setup_test_homeserver(config=hs_config)
# Don't attempt to reach out over federation.
self.mock_federation_client = Mock()
self.mock_federation_client.make_query.side_effect = CodeMessageException(
500, ""
)
richvdh marked this conversation as resolved.
Show resolved Hide resolved

hs = self.setup_test_homeserver(
config=hs_config, federation_client=self.mock_federation_client
)

load_legacy_spam_checkers(hs)

Expand All @@ -138,9 +151,6 @@ def make_homeserver(self, reactor, clock):
return hs

def prepare(self, reactor, clock, hs):
self.mock_distributor = Mock()
self.mock_distributor.declare("registered_user")
self.mock_captcha_client = Mock()
self.handler = self.hs.get_registration_handler()
self.store = self.hs.get_datastore()
self.lots_of_users = 100
Expand Down