aboutsummaryrefslogtreecommitdiffstats
path: root/pydis_site/apps
diff options
context:
space:
mode:
authorGravatar Leon Sandøy <[email protected]>2020-07-30 12:38:31 +0200
committerGravatar Leon Sandøy <[email protected]>2020-07-30 12:38:31 +0200
commitde89a3c39c306274a75a41b528fa14155b00f392 (patch)
treee0c473c2081a06282b549c2cfb81907e087b9e5d /pydis_site/apps
parentAdd a migration for all the existing data. (diff)
Delete FilterList objects for tests.
Now that we have a migration that adds data, we can no longer have tests that operate on the assumption that the database is going to be empty. So, we're now clearing that table before these tests run.
Diffstat (limited to 'pydis_site/apps')
-rw-r--r--pydis_site/apps/api/tests/test_filterlists.py10
1 files changed, 10 insertions, 0 deletions
diff --git a/pydis_site/apps/api/tests/test_filterlists.py b/pydis_site/apps/api/tests/test_filterlists.py
index 47aaaf31..188c0fff 100644
--- a/pydis_site/apps/api/tests/test_filterlists.py
+++ b/pydis_site/apps/api/tests/test_filterlists.py
@@ -28,6 +28,10 @@ class UnauthenticatedTests(APISubdomainTestCase):
class EmptyDatabaseTests(APISubdomainTestCase):
+ @classmethod
+ def setUpTestData(cls):
+ FilterList.objects.all().delete()
+
def test_returns_empty_object(self):
response = self.client.get(URL)
@@ -38,6 +42,7 @@ class EmptyDatabaseTests(APISubdomainTestCase):
class FetchTests(APISubdomainTestCase):
@classmethod
def setUpTestData(cls):
+ FilterList.objects.all().delete()
cls.jpeg_format = FilterList.objects.create(**JPEG_ALLOWLIST)
cls.png_format = FilterList.objects.create(**PNG_ALLOWLIST)
@@ -64,6 +69,10 @@ class FetchTests(APISubdomainTestCase):
class CreationTests(APISubdomainTestCase):
+ @classmethod
+ def setUpTestData(cls):
+ FilterList.objects.all().delete()
+
def test_returns_400_for_missing_params(self):
no_type_json = {
"allowed": True,
@@ -97,6 +106,7 @@ class CreationTests(APISubdomainTestCase):
class DeletionTests(APISubdomainTestCase):
@classmethod
def setUpTestData(cls):
+ FilterList.objects.all().delete()
cls.jpeg_format = FilterList.objects.create(**JPEG_ALLOWLIST)
cls.png_format = FilterList.objects.create(**PNG_ALLOWLIST)