summary refs log tree commit diff
path: root/tests/replication/test_auth.py
diff options
context:
space:
mode:
Diffstat (limited to 'tests/replication/test_auth.py')
-rw-r--r--tests/replication/test_auth.py26
1 files changed, 12 insertions, 14 deletions
diff --git a/tests/replication/test_auth.py b/tests/replication/test_auth.py
index fe9e4d5f9a..f35a5235e1 100644
--- a/tests/replication/test_auth.py
+++ b/tests/replication/test_auth.py
@@ -13,9 +13,7 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 import logging
-from typing import Tuple
 
-from synapse.http.site import SynapseRequest
 from synapse.rest.client.v2_alpha import register
 
 from tests.replication._base import BaseMultiWorkerStreamTestCase
@@ -47,7 +45,7 @@ class WorkerAuthenticationTestCase(BaseMultiWorkerStreamTestCase):
 
         return config
 
-    def _test_register(self) -> Tuple[SynapseRequest, FakeChannel]:
+    def _test_register(self) -> FakeChannel:
         """Run the actual test:
 
         1. Create a worker homeserver.
@@ -59,14 +57,14 @@ class WorkerAuthenticationTestCase(BaseMultiWorkerStreamTestCase):
         worker_hs = self.make_worker_hs("synapse.app.client_reader")
         site = self._hs_to_site[worker_hs]
 
-        request_1, channel_1 = make_request(
+        channel_1 = make_request(
             self.reactor,
             site,
             "POST",
             "register",
             {"username": "user", "type": "m.login.password", "password": "bar"},
-        )  # type: SynapseRequest, FakeChannel
-        self.assertEqual(request_1.code, 401)
+        )
+        self.assertEqual(channel_1.code, 401)
 
         # Grab the session
         session = channel_1.json_body["session"]
@@ -83,8 +81,8 @@ class WorkerAuthenticationTestCase(BaseMultiWorkerStreamTestCase):
     def test_no_auth(self):
         """With no authentication the request should finish.
         """
-        request, channel = self._test_register()
-        self.assertEqual(request.code, 200)
+        channel = self._test_register()
+        self.assertEqual(channel.code, 200)
 
         # We're given a registered user.
         self.assertEqual(channel.json_body["user_id"], "@user:test")
@@ -93,8 +91,8 @@ class WorkerAuthenticationTestCase(BaseMultiWorkerStreamTestCase):
     def test_missing_auth(self):
         """If the main process expects a secret that is not provided, an error results.
         """
-        request, channel = self._test_register()
-        self.assertEqual(request.code, 500)
+        channel = self._test_register()
+        self.assertEqual(channel.code, 500)
 
     @override_config(
         {
@@ -105,15 +103,15 @@ class WorkerAuthenticationTestCase(BaseMultiWorkerStreamTestCase):
     def test_unauthorized(self):
         """If the main process receives the wrong secret, an error results.
         """
-        request, channel = self._test_register()
-        self.assertEqual(request.code, 500)
+        channel = self._test_register()
+        self.assertEqual(channel.code, 500)
 
     @override_config({"worker_replication_secret": "my-secret"})
     def test_authorized(self):
         """The request should finish when the worker provides the authentication header.
         """
-        request, channel = self._test_register()
-        self.assertEqual(request.code, 200)
+        channel = self._test_register()
+        self.assertEqual(channel.code, 200)
 
         # We're given a registered user.
         self.assertEqual(channel.json_body["user_id"], "@user:test")