mirror of
https://git.anonymousland.org/anonymousland/synapse.git
synced 2025-08-19 01:17:47 -04:00
Use HTTPStatus constants in place of literals in tests. (#13297)
This commit is contained in:
parent
7b67e93d49
commit
96cf81e312
9 changed files with 308 additions and 238 deletions
|
@ -13,6 +13,7 @@
|
|||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
import logging
|
||||
from http import HTTPStatus
|
||||
|
||||
from parameterized import parameterized
|
||||
|
||||
|
@ -58,7 +59,7 @@ class FederationServerTests(unittest.FederatingHomeserverTestCase):
|
|||
"/_matrix/federation/v1/get_missing_events/%s" % (room_1,),
|
||||
query_content,
|
||||
)
|
||||
self.assertEqual(400, channel.code, channel.result)
|
||||
self.assertEqual(HTTPStatus.BAD_REQUEST, channel.code, channel.result)
|
||||
self.assertEqual(channel.json_body["errcode"], "M_NOT_JSON")
|
||||
|
||||
|
||||
|
@ -119,7 +120,7 @@ class StateQueryTests(unittest.FederatingHomeserverTestCase):
|
|||
channel = self.make_signed_federation_request(
|
||||
"GET", "/_matrix/federation/v1/state/%s?event_id=xyz" % (room_1,)
|
||||
)
|
||||
self.assertEqual(403, channel.code, channel.result)
|
||||
self.assertEqual(HTTPStatus.FORBIDDEN, channel.code, channel.result)
|
||||
self.assertEqual(channel.json_body["errcode"], "M_FORBIDDEN")
|
||||
|
||||
|
||||
|
@ -153,7 +154,7 @@ class SendJoinFederationTests(unittest.FederatingHomeserverTestCase):
|
|||
f"/_matrix/federation/v1/make_join/{self._room_id}/{user_id}"
|
||||
f"?ver={DEFAULT_ROOM_VERSION}",
|
||||
)
|
||||
self.assertEqual(channel.code, 200, channel.json_body)
|
||||
self.assertEqual(channel.code, HTTPStatus.OK, channel.json_body)
|
||||
return channel.json_body
|
||||
|
||||
def test_send_join(self):
|
||||
|
@ -171,7 +172,7 @@ class SendJoinFederationTests(unittest.FederatingHomeserverTestCase):
|
|||
f"/_matrix/federation/v2/send_join/{self._room_id}/x",
|
||||
content=join_event_dict,
|
||||
)
|
||||
self.assertEqual(channel.code, 200, channel.json_body)
|
||||
self.assertEqual(channel.code, HTTPStatus.OK, channel.json_body)
|
||||
|
||||
# we should get complete room state back
|
||||
returned_state = [
|
||||
|
@ -226,7 +227,7 @@ class SendJoinFederationTests(unittest.FederatingHomeserverTestCase):
|
|||
f"/_matrix/federation/v2/send_join/{self._room_id}/x?org.matrix.msc3706.partial_state=true",
|
||||
content=join_event_dict,
|
||||
)
|
||||
self.assertEqual(channel.code, 200, channel.json_body)
|
||||
self.assertEqual(channel.code, HTTPStatus.OK, channel.json_body)
|
||||
|
||||
# expect a reduced room state
|
||||
returned_state = [
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue