diff options
author | Erik Johnston <erik@matrix.org> | 2020-11-18 15:43:11 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-11-18 15:43:11 +0000 |
commit | 03e392f787df3fb8d23aca0964695a5caa075940 (patch) | |
tree | aadee5e1b5d04b4b3217d7ab2400e136e74f22ae | |
parent | SAML: Document allowing a clock/time difference from IdP (#8731) (diff) | |
download | synapse-03e392f787df3fb8d23aca0964695a5caa075940.tar.xz |
Fix tests on develop (#8777)
This was broken due to #8617 and #8761.
-rw-r--r-- | changelog.d/8777.misc | 1 | ||||
-rw-r--r-- | tests/rest/admin/test_user.py | 16 |
2 files changed, 1 insertions, 16 deletions
diff --git a/changelog.d/8777.misc b/changelog.d/8777.misc new file mode 100644 index 0000000000..e6da7d038d --- /dev/null +++ b/changelog.d/8777.misc @@ -0,0 +1 @@ + Refactor test utilities for injecting HTTP requests. diff --git a/tests/rest/admin/test_user.py b/tests/rest/admin/test_user.py index cc8a70be04..9661af7e79 100644 --- a/tests/rest/admin/test_user.py +++ b/tests/rest/admin/test_user.py @@ -1574,7 +1574,6 @@ class UserTokenRestTestCase(unittest.HomeserverTestCase): request, channel = self.make_request( "POST", self.url, b"{}", access_token=self.admin_user_tok ) - self.render(request) self.assertEqual(200, int(channel.result["code"]), msg=channel.result["body"]) return channel.json_body["access_token"] @@ -1582,7 +1581,6 @@ class UserTokenRestTestCase(unittest.HomeserverTestCase): """Try to login as a user without authentication. """ request, channel = self.make_request("POST", self.url, b"{}") - self.render(request) self.assertEqual(401, int(channel.result["code"]), msg=channel.result["body"]) self.assertEqual(Codes.MISSING_TOKEN, channel.json_body["errcode"]) @@ -1593,7 +1591,6 @@ class UserTokenRestTestCase(unittest.HomeserverTestCase): request, channel = self.make_request( "POST", self.url, b"{}", access_token=self.other_user_tok ) - self.render(request) self.assertEqual(403, int(channel.result["code"]), msg=channel.result["body"]) @@ -1622,7 +1619,6 @@ class UserTokenRestTestCase(unittest.HomeserverTestCase): request, channel = self.make_request( "GET", "devices", b"{}", access_token=self.other_user_tok ) - self.render(request) self.assertEqual(200, int(channel.result["code"]), msg=channel.result["body"]) # We should only see the one device (from the login in `prepare`) @@ -1638,28 +1634,24 @@ class UserTokenRestTestCase(unittest.HomeserverTestCase): request, channel = self.make_request( "GET", "devices", b"{}", access_token=puppet_token ) - self.render(request) self.assertEqual(200, int(channel.result["code"]), msg=channel.result["body"]) # Logout with the puppet token request, channel = self.make_request( "POST", "logout", b"{}", access_token=puppet_token ) - self.render(request) self.assertEqual(200, int(channel.result["code"]), msg=channel.result["body"]) # The puppet token should no longer work request, channel = self.make_request( "GET", "devices", b"{}", access_token=puppet_token ) - self.render(request) self.assertEqual(401, int(channel.result["code"]), msg=channel.result["body"]) # .. but the real user's tokens should still work request, channel = self.make_request( "GET", "devices", b"{}", access_token=self.other_user_tok ) - self.render(request) self.assertEqual(200, int(channel.result["code"]), msg=channel.result["body"]) def test_user_logout_all(self): @@ -1673,28 +1665,24 @@ class UserTokenRestTestCase(unittest.HomeserverTestCase): request, channel = self.make_request( "GET", "devices", b"{}", access_token=puppet_token ) - self.render(request) self.assertEqual(200, int(channel.result["code"]), msg=channel.result["body"]) # Logout all with the real user token request, channel = self.make_request( "POST", "logout/all", b"{}", access_token=self.other_user_tok ) - self.render(request) self.assertEqual(200, int(channel.result["code"]), msg=channel.result["body"]) # The puppet token should still work request, channel = self.make_request( "GET", "devices", b"{}", access_token=puppet_token ) - self.render(request) self.assertEqual(200, int(channel.result["code"]), msg=channel.result["body"]) # .. but the real user's tokens shouldn't request, channel = self.make_request( "GET", "devices", b"{}", access_token=self.other_user_tok ) - self.render(request) self.assertEqual(401, int(channel.result["code"]), msg=channel.result["body"]) def test_admin_logout_all(self): @@ -1708,28 +1696,24 @@ class UserTokenRestTestCase(unittest.HomeserverTestCase): request, channel = self.make_request( "GET", "devices", b"{}", access_token=puppet_token ) - self.render(request) self.assertEqual(200, int(channel.result["code"]), msg=channel.result["body"]) # Logout all with the admin user token request, channel = self.make_request( "POST", "logout/all", b"{}", access_token=self.admin_user_tok ) - self.render(request) self.assertEqual(200, int(channel.result["code"]), msg=channel.result["body"]) # The puppet token should no longer work request, channel = self.make_request( "GET", "devices", b"{}", access_token=puppet_token ) - self.render(request) self.assertEqual(401, int(channel.result["code"]), msg=channel.result["body"]) # .. but the real user's tokens should still work request, channel = self.make_request( "GET", "devices", b"{}", access_token=self.other_user_tok ) - self.render(request) self.assertEqual(200, int(channel.result["code"]), msg=channel.result["body"]) @unittest.override_config( |