diff options
author | Dirk Klimpel <5740567+dklimpel@users.noreply.github.com> | 2022-07-17 23:28:45 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-07-17 22:28:45 +0100 |
commit | efee345b454ac5e6aeb4b4128793be1fbc308b91 (patch) | |
tree | f7e49ed0f8f3f3c65a01e60c79434cbc1b617cb2 /tests/unittest.py | |
parent | Make all `process_replication_rows` methods async (#13304) (diff) | |
download | synapse-efee345b454ac5e6aeb4b4128793be1fbc308b91.tar.xz |
Remove unnecessary `json.dumps` from tests (#13303)
Diffstat (limited to 'tests/unittest.py')
-rw-r--r-- | tests/unittest.py | 31 |
1 files changed, 12 insertions, 19 deletions
diff --git a/tests/unittest.py b/tests/unittest.py index 7b97a4bf6e..9f1ff774a8 100644 --- a/tests/unittest.py +++ b/tests/unittest.py @@ -16,7 +16,6 @@ import gc import hashlib import hmac -import json import logging import secrets import time @@ -619,20 +618,16 @@ class HomeserverTestCase(TestCase): want_mac.update(nonce.encode("ascii") + b"\x00" + nonce_str) want_mac_digest = want_mac.hexdigest() - body = json.dumps( - { - "nonce": nonce, - "username": username, - "displayname": displayname, - "password": password, - "admin": admin, - "mac": want_mac_digest, - "inhibit_login": True, - } - ) - channel = self.make_request( - "POST", "/_synapse/admin/v1/register", body.encode("utf8") - ) + body = { + "nonce": nonce, + "username": username, + "displayname": displayname, + "password": password, + "admin": admin, + "mac": want_mac_digest, + "inhibit_login": True, + } + channel = self.make_request("POST", "/_synapse/admin/v1/register", body) self.assertEqual(channel.code, 200, channel.json_body) user_id = channel.json_body["user_id"] @@ -676,9 +671,7 @@ class HomeserverTestCase(TestCase): custom_headers: Optional[Iterable[CustomHeaderType]] = None, ) -> str: """ - Log in a user, and get an access token. Requires the Login API be - registered. - + Log in a user, and get an access token. Requires the Login API be registered. """ body = {"type": "m.login.password", "user": username, "password": password} if device_id: @@ -687,7 +680,7 @@ class HomeserverTestCase(TestCase): channel = self.make_request( "POST", "/_matrix/client/r0/login", - json.dumps(body).encode("utf8"), + body, custom_headers=custom_headers, ) self.assertEqual(channel.code, 200, channel.result) |