mirror of
https://git.anonymousland.org/anonymousland/synapse.git
synced 2025-05-03 16:14:49 -04:00
Port tests/ to Python 3 (#3808)
This commit is contained in:
parent
c5440b2ca0
commit
52ec6e9dfa
12 changed files with 349 additions and 430 deletions
|
@ -185,20 +185,20 @@ class TestMauLimit(unittest.TestCase):
|
|||
self.assertEqual(e.errcode, Codes.RESOURCE_LIMIT_EXCEEDED)
|
||||
|
||||
def create_user(self, localpart):
|
||||
request_data = json.dumps({
|
||||
"username": localpart,
|
||||
"password": "monkey",
|
||||
"auth": {"type": LoginType.DUMMY},
|
||||
})
|
||||
request_data = json.dumps(
|
||||
{
|
||||
"username": localpart,
|
||||
"password": "monkey",
|
||||
"auth": {"type": LoginType.DUMMY},
|
||||
}
|
||||
)
|
||||
|
||||
request, channel = make_request(b"POST", b"/register", request_data)
|
||||
request, channel = make_request("POST", "/register", request_data)
|
||||
render(request, self.resource, self.reactor)
|
||||
|
||||
if channel.result["code"] != b"200":
|
||||
if channel.code != 200:
|
||||
raise HttpResponseException(
|
||||
int(channel.result["code"]),
|
||||
channel.result["reason"],
|
||||
channel.result["body"],
|
||||
channel.code, channel.result["reason"], channel.result["body"]
|
||||
).to_synapse_error()
|
||||
|
||||
access_token = channel.json_body["access_token"]
|
||||
|
@ -206,12 +206,12 @@ class TestMauLimit(unittest.TestCase):
|
|||
return access_token
|
||||
|
||||
def do_sync_for_user(self, token):
|
||||
request, channel = make_request(b"GET", b"/sync", access_token=token)
|
||||
request, channel = make_request(
|
||||
"GET", "/sync", access_token=token.encode('ascii')
|
||||
)
|
||||
render(request, self.resource, self.reactor)
|
||||
|
||||
if channel.result["code"] != b"200":
|
||||
if channel.code != 200:
|
||||
raise HttpResponseException(
|
||||
int(channel.result["code"]),
|
||||
channel.result["reason"],
|
||||
channel.result["body"],
|
||||
channel.code, channel.result["reason"], channel.result["body"]
|
||||
).to_synapse_error()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue