mirror of
https://git.anonymousland.org/anonymousland/synapse.git
synced 2025-06-19 08:04:07 -04:00
Replace request.code
with channel.code
The two are equivalent, but really we want to check the HTTP result that got returned to the channel, not the code that the Request object *intended* to return to the channel.
This commit is contained in:
parent
01333681bc
commit
7eebe4b3fc
8 changed files with 22 additions and 22 deletions
|
@ -66,7 +66,7 @@ class WorkerAuthenticationTestCase(BaseMultiWorkerStreamTestCase):
|
|||
"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"]
|
||||
|
@ -84,7 +84,7 @@ class WorkerAuthenticationTestCase(BaseMultiWorkerStreamTestCase):
|
|||
"""With no authentication the request should finish.
|
||||
"""
|
||||
request, channel = self._test_register()
|
||||
self.assertEqual(request.code, 200)
|
||||
self.assertEqual(channel.code, 200)
|
||||
|
||||
# We're given a registered user.
|
||||
self.assertEqual(channel.json_body["user_id"], "@user:test")
|
||||
|
@ -94,7 +94,7 @@ class WorkerAuthenticationTestCase(BaseMultiWorkerStreamTestCase):
|
|||
"""If the main process expects a secret that is not provided, an error results.
|
||||
"""
|
||||
request, channel = self._test_register()
|
||||
self.assertEqual(request.code, 500)
|
||||
self.assertEqual(channel.code, 500)
|
||||
|
||||
@override_config(
|
||||
{
|
||||
|
@ -106,14 +106,14 @@ class WorkerAuthenticationTestCase(BaseMultiWorkerStreamTestCase):
|
|||
"""If the main process receives the wrong secret, an error results.
|
||||
"""
|
||||
request, channel = self._test_register()
|
||||
self.assertEqual(request.code, 500)
|
||||
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)
|
||||
self.assertEqual(channel.code, 200)
|
||||
|
||||
# We're given a registered user.
|
||||
self.assertEqual(channel.json_body["user_id"], "@user:test")
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue