diff options
author | 2021-05-22 13:35:13 -0700 | |
---|---|---|
committer | 2021-05-22 13:35:13 -0700 | |
commit | e3696a3b95204b452c18db910352df5617a7e77b (patch) | |
tree | 6a1ac3794df890ed71f580cfa48cc6a03898d9c5 /pydis_site | |
parent | Add a test for ordering infractions returned from the api (diff) |
Add tests for failure states of `expires_before` and `expires_after` filters
Diffstat (limited to 'pydis_site')
-rw-r--r-- | pydis_site/apps/api/tests/test_infractions.py | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/pydis_site/apps/api/tests/test_infractions.py b/pydis_site/apps/api/tests/test_infractions.py index fe51307d..0f9a53c2 100644 --- a/pydis_site/apps/api/tests/test_infractions.py +++ b/pydis_site/apps/api/tests/test_infractions.py @@ -163,6 +163,20 @@ class InfractionTests(APISubdomainTestCase): self.assertEqual(len(infractions), 1) self.assertEqual(infractions[0]['id'], self.superstar_expires_soon.id) + def test_filter_after_invalid(self): + url = reverse('bot:infraction-list', host='api') + response = self.client.get(f'{url}?expires_after=gibberish') + + self.assertEqual(response.status_code, 400) + self.assertEqual(list(response.json())[0], "expires_after") + + def test_filter_before_invalid(self): + url = reverse('bot:infraction-list', host='api') + response = self.client.get(f'{url}?expires_before=000000000') + + self.assertEqual(response.status_code, 400) + self.assertEqual(list(response.json())[0], "expires_before") + def test_filter_manytypes(self): url = reverse('bot:infraction-list', host='api') response = self.client.get(f'{url}?types=mute,ban') |