summary refs log tree commit diff
path: root/tests/rest/client/v2_alpha
diff options
context:
space:
mode:
authorRichard van der Hoff <richard@matrix.org>2020-12-15 14:51:25 +0000
committerRichard van der Hoff <richard@matrix.org>2020-12-15 22:32:12 +0000
commit7eebe4b3fc3129e4571d58c3cea5eeccc584e072 (patch)
tree3dff8e5f146206d5724162f859491bd22a52f4a9 /tests/rest/client/v2_alpha
parentPreparatory refactoring of the SamlHandlerTestCase (#8938) (diff)
downloadsynapse-7eebe4b3fc3129e4571d58c3cea5eeccc584e072.tar.xz
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.
Diffstat (limited to 'tests/rest/client/v2_alpha')
-rw-r--r--tests/rest/client/v2_alpha/test_account.py4
-rw-r--r--tests/rest/client/v2_alpha/test_auth.py10
-rw-r--r--tests/rest/client/v2_alpha/test_register.py2
3 files changed, 8 insertions, 8 deletions
diff --git a/tests/rest/client/v2_alpha/test_account.py b/tests/rest/client/v2_alpha/test_account.py
index 2ac1ecb7d3..11a042f9e9 100644
--- a/tests/rest/client/v2_alpha/test_account.py
+++ b/tests/rest/client/v2_alpha/test_account.py
@@ -353,7 +353,7 @@ class DeactivateTestCase(unittest.HomeserverTestCase):
 
         # Check that this access token has been invalidated.
         request, channel = self.make_request("GET", "account/whoami")
-        self.assertEqual(request.code, 401)
+        self.assertEqual(channel.code, 401)
 
     def test_pending_invites(self):
         """Tests that deactivating a user rejects every pending invite for them."""
@@ -410,7 +410,7 @@ class DeactivateTestCase(unittest.HomeserverTestCase):
         request, channel = self.make_request(
             "POST", "account/deactivate", request_data, access_token=tok
         )
-        self.assertEqual(request.code, 200)
+        self.assertEqual(channel.code, 200)
 
 
 class ThreepidEmailRestTestCase(unittest.HomeserverTestCase):
diff --git a/tests/rest/client/v2_alpha/test_auth.py b/tests/rest/client/v2_alpha/test_auth.py
index ac67a9de29..a35c2646fb 100644
--- a/tests/rest/client/v2_alpha/test_auth.py
+++ b/tests/rest/client/v2_alpha/test_auth.py
@@ -71,7 +71,7 @@ class FallbackAuthTests(unittest.HomeserverTestCase):
             "POST", "register", body
         )  # type: SynapseRequest, FakeChannel
 
-        self.assertEqual(request.code, expected_response)
+        self.assertEqual(channel.code, expected_response)
         return channel
 
     def recaptcha(
@@ -84,7 +84,7 @@ class FallbackAuthTests(unittest.HomeserverTestCase):
         request, channel = self.make_request(
             "GET", "auth/m.login.recaptcha/fallback/web?session=" + session
         )  # type: SynapseRequest, FakeChannel
-        self.assertEqual(request.code, 200)
+        self.assertEqual(channel.code, 200)
 
         request, channel = self.make_request(
             "POST",
@@ -92,7 +92,7 @@ class FallbackAuthTests(unittest.HomeserverTestCase):
             + post_session
             + "&g-recaptcha-response=a",
         )
-        self.assertEqual(request.code, expected_post_response)
+        self.assertEqual(channel.code, expected_post_response)
 
         # The recaptcha handler is called with the response given
         attempts = self.recaptcha_checker.recaptcha_attempts
@@ -201,7 +201,7 @@ class UIAuthTests(unittest.HomeserverTestCase):
         )  # type: SynapseRequest, FakeChannel
 
         # Ensure the response is sane.
-        self.assertEqual(request.code, expected_response)
+        self.assertEqual(channel.code, expected_response)
 
         return channel
 
@@ -214,7 +214,7 @@ class UIAuthTests(unittest.HomeserverTestCase):
         )  # type: SynapseRequest, FakeChannel
 
         # Ensure the response is sane.
-        self.assertEqual(request.code, expected_response)
+        self.assertEqual(channel.code, expected_response)
 
         return channel
 
diff --git a/tests/rest/client/v2_alpha/test_register.py b/tests/rest/client/v2_alpha/test_register.py
index bcb21d0ced..4bf3e0d63b 100644
--- a/tests/rest/client/v2_alpha/test_register.py
+++ b/tests/rest/client/v2_alpha/test_register.py
@@ -559,7 +559,7 @@ class AccountValidityRenewalByEmailTestCase(unittest.HomeserverTestCase):
         request, channel = self.make_request(
             "POST", "account/deactivate", request_data, access_token=tok
         )
-        self.assertEqual(request.code, 200)
+        self.assertEqual(channel.code, 200)
 
         self.reactor.advance(datetime.timedelta(days=8).total_seconds())