diff options
Diffstat (limited to 'pydis_site/apps/api/tests')
-rw-r--r-- | pydis_site/apps/api/tests/test_infractions.py | 5 | ||||
-rw-r--r-- | pydis_site/apps/api/tests/test_off_topic_channel_names.py | 18 |
2 files changed, 14 insertions, 9 deletions
diff --git a/pydis_site/apps/api/tests/test_infractions.py b/pydis_site/apps/api/tests/test_infractions.py index 7c370c17..0092d355 100644 --- a/pydis_site/apps/api/tests/test_infractions.py +++ b/pydis_site/apps/api/tests/test_infractions.py @@ -63,6 +63,7 @@ class InfractionTests(APISubdomainTestCase): ) def test_list_all(self): + """Tests the list-view, which should be ordered by inserted_at (newest first).""" url = reverse('bot:infraction-list', host='api') response = self.client.get(url) @@ -70,8 +71,8 @@ class InfractionTests(APISubdomainTestCase): infractions = response.json() self.assertEqual(len(infractions), 2) - self.assertEqual(infractions[0]['id'], self.ban_hidden.id) - self.assertEqual(infractions[1]['id'], self.ban_inactive.id) + self.assertEqual(infractions[0]['id'], self.ban_inactive.id) + self.assertEqual(infractions[1]['id'], self.ban_hidden.id) def test_filter_search(self): url = reverse('bot:infraction-list', host='api') diff --git a/pydis_site/apps/api/tests/test_off_topic_channel_names.py b/pydis_site/apps/api/tests/test_off_topic_channel_names.py index 60af1f62..9ab71409 100644 --- a/pydis_site/apps/api/tests/test_off_topic_channel_names.py +++ b/pydis_site/apps/api/tests/test_off_topic_channel_names.py @@ -88,16 +88,20 @@ class CreationTests(APISubdomainTestCase): super().setUp() url = reverse('bot:offtopicchannelname-list', host='api') - self.name = "lemonade-shop" + self.name = "abcdefghijklmnopqrstuvwxyz-0123456789" response = self.client.post(f'{url}?name={self.name}') self.assertEqual(response.status_code, 201) - def test_name_in_full_list(self): + def test_returns_201_for_unicode_chars(self): url = reverse('bot:offtopicchannelname-list', host='api') - response = self.client.get(url) + names = ( + '𝖠𝖡𝖢𝖣𝖤𝖥𝖦𝖧𝖨𝖩𝖪𝖫𝖬𝖭𝖮𝖯𝖰𝖱𝖲𝖳𝖴𝖵𝖶𝖷𝖸𝖹', + 'ǃ?’', + ) - self.assertEqual(response.status_code, 200) - self.assertEqual(response.json(), [self.name]) + for name in names: + response = self.client.post(f'{url}?name={name}') + self.assertEqual(response.status_code, 201) def test_returns_400_for_missing_name_param(self): url = reverse('bot:offtopicchannelname-list', host='api') @@ -111,8 +115,8 @@ class CreationTests(APISubdomainTestCase): url = reverse('bot:offtopicchannelname-list', host='api') invalid_names = ( 'space between words', - 'UPPERCASE', - '$$$$$$$$' + 'ABCDEFGHIJKLMNOPQRSTUVWXYZ', + '!?\'@#$%^&*()', ) for name in invalid_names: |