0
0
Fork 1
mirror of https://mau.dev/maunium/synapse.git synced 2024-12-14 05:13:47 +01:00

remove unused resource_for_federation

This is now only used in `test_typing`, so move it there.
This commit is contained in:
Richard van der Hoff 2020-12-02 17:40:31 +00:00
parent 90cf1eec44
commit c834f1d67a
2 changed files with 13 additions and 18 deletions

View file

@ -21,12 +21,13 @@ from mock import ANY, Mock, call
from twisted.internet import defer
from synapse.api.errors import AuthError
from synapse.federation.transport import server as federation_server
from synapse.types import UserID, create_requester
from synapse.util.ratelimitutils import FederationRateLimiter
from tests import unittest
from tests.test_utils import make_awaitable
from tests.unittest import override_config
from tests.utils import register_federation_servlets
# Some local users to test with
U_APPLE = UserID.from_string("@apple:test")
@ -52,6 +53,17 @@ def _make_edu_transaction_json(edu_type, content):
return json.dumps(_expect_edu_transaction(edu_type, content)).encode("utf8")
def register_federation_servlets(hs, resource):
federation_server.register_servlets(
hs,
resource=resource,
authenticator=federation_server.Authenticator(hs),
ratelimiter=FederationRateLimiter(
hs.get_clock(), config=hs.config.rc_federation
),
)
class TypingNotificationsTestCase(unittest.HomeserverTestCase):
servlets = [register_federation_servlets]

View file

@ -34,7 +34,6 @@ from synapse.api.room_versions import RoomVersions
from synapse.config.database import DatabaseConnectionConfig
from synapse.config.homeserver import HomeServerConfig
from synapse.config.server import DEFAULT_ROOM_VERSION
from synapse.federation.transport import server as federation_server
from synapse.http.server import HttpServer
from synapse.logging.context import current_context, set_current_context
from synapse.server import HomeServer
@ -42,7 +41,6 @@ from synapse.storage import DataStore
from synapse.storage.database import LoggingDatabaseConnection
from synapse.storage.engines import PostgresEngine, create_engine
from synapse.storage.prepare_database import prepare_database
from synapse.util.ratelimitutils import FederationRateLimiter
# set this to True to run the tests against postgres instead of sqlite.
#
@ -342,24 +340,9 @@ def setup_test_homeserver(
hs.get_auth_handler().validate_hash = validate_hash
fed = kwargs.get("resource_for_federation", None)
if fed:
register_federation_servlets(hs, fed)
return hs
def register_federation_servlets(hs, resource):
federation_server.register_servlets(
hs,
resource=resource,
authenticator=federation_server.Authenticator(hs),
ratelimiter=FederationRateLimiter(
hs.get_clock(), config=hs.config.rc_federation
),
)
def get_mock_call_args(pattern_func, mock_func):
""" Return the arguments the mock function was called with interpreted
by the pattern functions argument list.