mirror of
https://git.anonymousland.org/anonymousland/synapse.git
synced 2025-05-02 10:46:06 -04:00
Remove unnecessary json.dumps
from tests (#13303)
This commit is contained in:
parent
5d4028f217
commit
efee345b45
13 changed files with 143 additions and 200 deletions
|
@ -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)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue