Use literals in place of HTTPStatus constants in tests (#13463)

This commit is contained in:
Dirk Klimpel 2022-08-05 16:59:09 +02:00 committed by GitHub
parent 3d2cabf966
commit e2ed1b7155
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
18 changed files with 172 additions and 191 deletions

View file

@ -140,7 +140,7 @@ class RestHelper:
custom_headers=custom_headers,
)
assert channel.result["code"] == b"%d" % expect_code, channel.result
assert channel.code == expect_code, channel.result
self.auth_user_id = temp_id
if expect_code == HTTPStatus.OK:
@ -213,11 +213,9 @@ class RestHelper:
data,
)
assert (
int(channel.result["code"]) == expect_code
), "Expected: %d, got: %d, resp: %r" % (
assert channel.code == expect_code, "Expected: %d, got: %d, resp: %r" % (
expect_code,
int(channel.result["code"]),
channel.code,
channel.result["body"],
)
@ -312,11 +310,9 @@ class RestHelper:
data,
)
assert (
int(channel.result["code"]) == expect_code
), "Expected: %d, got: %d, resp: %r" % (
assert channel.code == expect_code, "Expected: %d, got: %d, resp: %r" % (
expect_code,
int(channel.result["code"]),
channel.code,
channel.result["body"],
)
@ -396,11 +392,9 @@ class RestHelper:
custom_headers=custom_headers,
)
assert (
int(channel.result["code"]) == expect_code
), "Expected: %d, got: %d, resp: %r" % (
assert channel.code == expect_code, "Expected: %d, got: %d, resp: %r" % (
expect_code,
int(channel.result["code"]),
channel.code,
channel.result["body"],
)
@ -449,11 +443,9 @@ class RestHelper:
channel = make_request(self.hs.get_reactor(), self.site, method, path, content)
assert (
int(channel.result["code"]) == expect_code
), "Expected: %d, got: %d, resp: %r" % (
assert channel.code == expect_code, "Expected: %d, got: %d, resp: %r" % (
expect_code,
int(channel.result["code"]),
channel.code,
channel.result["body"],
)
@ -545,7 +537,7 @@ class RestHelper:
assert channel.code == expect_code, "Expected: %d, got: %d, resp: %r" % (
expect_code,
int(channel.result["code"]),
channel.code,
channel.result["body"],
)