Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
synapse
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Terraform modules
Monitor
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Timo Ley
synapse
Commits
c834f1d6
Commit
c834f1d6
authored
4 years ago
by
Richard van der Hoff
Browse files
Options
Downloads
Patches
Plain Diff
remove unused `resource_for_federation`
This is now only used in `test_typing`, so move it there.
parent
90cf1eec
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
tests/handlers/test_typing.py
+13
-1
13 additions, 1 deletion
tests/handlers/test_typing.py
tests/utils.py
+0
-17
0 additions, 17 deletions
tests/utils.py
with
13 additions
and
18 deletions
tests/handlers/test_typing.py
+
13
−
1
View file @
c834f1d6
...
...
@@ -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
]
...
...
This diff is collapsed.
Click to expand it.
tests/utils.py
+
0
−
17
View file @
c834f1d6
...
...
@@ -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.
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment