|
4 | 4 | import unittest
|
5 | 5 |
|
6 | 6 |
|
| 7 | +class TestEventParticipant200(unittest.TestCase): |
| 8 | + response_json: dict[str, t.Any] |
| 9 | + response_object: event_api.ParticipantResponse |
| 10 | + |
| 11 | + def setUp(self: "TestEventParticipant200") -> None: |
| 12 | + with open("event/mock_data/200_participant.json") as f: |
| 13 | + f: t.TextIO |
| 14 | + self.response_json = json.loads(f.read()) |
| 15 | + self.response_object = event_api.ParticipantResponse(self.response_json) |
| 16 | + |
| 17 | + def test_creator_returned(self: "TestEventParticipant200") -> None: |
| 18 | + self.assertIsInstance(self.response_object.data, event_api.responses.Creator) |
| 19 | + |
| 20 | + |
| 21 | +class TestParticipantEndpoint404(unittest.TestCase): |
| 22 | + def test_participant_invalid_team_exception(self: "TestParticipantEndpoint404") -> None: |
| 23 | + with open("event/mock_data/404_participant.json") as f: |
| 24 | + f: t.TextIO |
| 25 | + response_json: dict[str, t.Any] = json.loads(f.read()) |
| 26 | + self.assertRaises(event_api.exceptions.InvalidParticipantError, event_api.ParticipantResponse, response_json) |
| 27 | + |
| 28 | + |
| 29 | +class TestParticipantEndpoint429(unittest.TestCase): |
| 30 | + def test_participant_ratelimit_exception(self: "TestParticipantEndpoint429") -> None: |
| 31 | + with open("event/mock_data/429_ratelimit.json") as f: |
| 32 | + f: t.TextIO |
| 33 | + response_json: dict[str, t.Any] = json.loads(f.read()) |
| 34 | + self.assertRaises(event_api.exceptions.RateLimitError, event_api.ParticipantResponse, response_json) |
| 35 | + |
| 36 | + |
7 | 37 | class TestEventParticipants200(unittest.TestCase):
|
8 | 38 | response_json: dict[str, t.Any]
|
9 | 39 | response_object: event_api.ParticipantsResponse
|
|
0 commit comments