diff --git a/changelog.d/11455.misc b/changelog.d/11455.misc new file mode 100644 index 000000000000..7c83f62e3fa5 --- /dev/null +++ b/changelog.d/11455.misc @@ -0,0 +1 @@ +Convert status codes to `HTTPStatus` in `synapse.rest.admin`. \ No newline at end of file diff --git a/tests/rest/admin/test_media.py b/tests/rest/admin/test_media.py index 165b21d9c744..71158ac5ee18 100644 --- a/tests/rest/admin/test_media.py +++ b/tests/rest/admin/test_media.py @@ -15,6 +15,7 @@ import json import os +from http import HTTPStatus from parameterized import parameterized diff --git a/tests/rest/admin/test_registration_tokens.py b/tests/rest/admin/test_registration_tokens.py index d7ba5938cd9a..63087955f2a7 100644 --- a/tests/rest/admin/test_registration_tokens.py +++ b/tests/rest/admin/test_registration_tokens.py @@ -205,9 +205,7 @@ def test_create_token_already_exists(self): data, access_token=self.admin_user_tok, ) - self.assertEqual( - HTTPStatus.BAD_REQUEST, channel2.code, msg=channel2.json_body - ) + self.assertEqual(HTTPStatus.BAD_REQUEST, channel2.code, msg=channel2.json_body) self.assertEqual(channel2.json_body["errcode"], Codes.INVALID_PARAM) def test_create_unable_to_generate_token(self): diff --git a/tests/rest/admin/test_server_notice.py b/tests/rest/admin/test_server_notice.py index c36f634f4f5d..0b9da4c732ea 100644 --- a/tests/rest/admin/test_server_notice.py +++ b/tests/rest/admin/test_server_notice.py @@ -12,6 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. +from http import HTTPStatus from typing import List import synapse.rest.admin diff --git a/tests/rest/admin/test_username_available.py b/tests/rest/admin/test_username_available.py index 70067b7fb529..7978626e7197 100644 --- a/tests/rest/admin/test_username_available.py +++ b/tests/rest/admin/test_username_available.py @@ -12,6 +12,8 @@ # See the License for the specific language governing permissions and # limitations under the License. +from http import HTTPStatus + import synapse.rest.admin from synapse.api.errors import Codes, SynapseError from synapse.rest.client import login