Remove unnecessary json.dumps from tests (#13303)

This commit is contained in:
Dirk Klimpel 2022-07-17 23:28:45 +02:00 committed by GitHub
parent 5d4028f217
commit efee345b45
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
13 changed files with 143 additions and 200 deletions

View file

@ -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)