Skip to content
This repository has been archived by the owner on Apr 26, 2024. It is now read-only.

Commit

Permalink
Add a test for reporting non-existent event IDs
Browse files Browse the repository at this point in the history
  • Loading branch information
reivilibre committed Feb 14, 2023
1 parent 8e33085 commit f321af7
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions tests/rest/client/test_report_event.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,18 @@ def test_reason_and_score_null(self) -> None:
data = {"reason": None, "score": None}
self._assert_status(400, data)

def test_cannot_report_nonexistent_event(self) -> None:
"""
Tests that we don't accept event reports for events which do not exist.
"""
channel = self.make_request(
"POST",
f"rooms/{self.room_id}/report/$nonsenseeventid:test",
{"reason": "i am very sad"},
access_token=self.other_user_tok,
)
self.assertEqual(404, channel.code, msg=channel.result["body"])

def _assert_status(self, response_status: int, data: JsonDict) -> None:
channel = self.make_request(
"POST", self.report_path, data, access_token=self.other_user_tok
Expand Down

0 comments on commit f321af7

Please sign in to comment.