diff options
author | 2020-07-27 09:53:38 +0200 | |
---|---|---|
committer | 2020-07-27 09:53:38 +0200 | |
commit | 285c81bc13e996246ad9463951853fc12903d766 (patch) | |
tree | ce6d40f8bdf494cb438f94676e16fbf98c167a37 /pydis_site/apps/api/tests | |
parent | Minor changes to tests, use subTest. (diff) |
Rename AllowDenyList to FilterList
Diffstat (limited to 'pydis_site/apps/api/tests')
-rw-r--r-- | pydis_site/apps/api/tests/test_filterlists.py (renamed from pydis_site/apps/api/tests/test_allowlists.py) | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/pydis_site/apps/api/tests/test_allowlists.py b/pydis_site/apps/api/tests/test_filterlists.py index fd8772d0..b577c31c 100644 --- a/pydis_site/apps/api/tests/test_allowlists.py +++ b/pydis_site/apps/api/tests/test_filterlists.py @@ -1,9 +1,9 @@ from django_hosts.resolvers import reverse -from pydis_site.apps.api.models import AllowDenyList +from pydis_site.apps.api.models import FilterList from pydis_site.apps.api.tests.base import APISubdomainTestCase -URL = reverse('bot:allowdenylist-list', host='api') +URL = reverse('bot:filterlist-list', host='api') JPEG_ALLOWLIST = { "type": 'FILE_FORMAT', "allowed": True, @@ -38,8 +38,8 @@ class EmptyDatabaseTests(APISubdomainTestCase): class FetchTests(APISubdomainTestCase): @classmethod def setUpTestData(cls): - cls.jpeg_format = AllowDenyList.objects.create(**JPEG_ALLOWLIST) - cls.png_format = AllowDenyList.objects.create(**PNG_ALLOWLIST) + cls.jpeg_format = FilterList.objects.create(**JPEG_ALLOWLIST) + cls.png_format = FilterList.objects.create(**PNG_ALLOWLIST) def test_returns_name_in_list(self): response = self.client.get(URL) @@ -54,11 +54,11 @@ class FetchTests(APISubdomainTestCase): self.assertEqual(response.status_code, 200) self.assertEqual(response.json().get("content"), self.jpeg_format.content) - def test_returns_allow_deny_list_types(self): - response = self.client.get(f'{URL}/get_types') + def test_returns_filter_list_types(self): + response = self.client.get(f'{URL}/get-types') self.assertEqual(response.status_code, 200) - for api_type, model_type in zip(response.json(), AllowDenyList.AllowDenyListType.choices): + for api_type, model_type in zip(response.json(), FilterList.FilterListType.choices): self.assertEquals(api_type[0], model_type[0]) self.assertEquals(api_type[1], model_type[1]) @@ -92,8 +92,8 @@ class CreationTests(APISubdomainTestCase): class DeletionTests(APISubdomainTestCase): @classmethod def setUpTestData(cls): - cls.jpeg_format = AllowDenyList.objects.create(**JPEG_ALLOWLIST) - cls.png_format = AllowDenyList.objects.create(**PNG_ALLOWLIST) + cls.jpeg_format = FilterList.objects.create(**JPEG_ALLOWLIST) + cls.png_format = FilterList.objects.create(**PNG_ALLOWLIST) def test_deleting_unknown_id_returns_404(self): response = self.client.delete(f"{URL}/200") |