From c8cf68acfccfa09b818a9278394949a9a9147c9b Mon Sep 17 00:00:00 2001 From: Chris Wesseling Date: Fri, 22 Dec 2023 11:22:05 +0100 Subject: [PATCH] =?UTF-8?q?=E2=9C=85=20Add=20admin=20test=20for=20full=20c?= =?UTF-8?q?overage?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../referentielijsten/tests/__init__.py | 0 .../referentielijsten/tests/test_admin.py | 48 +++++++++++++++++++ 2 files changed, 48 insertions(+) create mode 100644 src/openklant/components/referentielijsten/tests/__init__.py create mode 100644 src/openklant/components/referentielijsten/tests/test_admin.py diff --git a/src/openklant/components/referentielijsten/tests/__init__.py b/src/openklant/components/referentielijsten/tests/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/src/openklant/components/referentielijsten/tests/test_admin.py b/src/openklant/components/referentielijsten/tests/test_admin.py new file mode 100644 index 00000000..cc7f8bb0 --- /dev/null +++ b/src/openklant/components/referentielijsten/tests/test_admin.py @@ -0,0 +1,48 @@ +import datetime + +from django.contrib.auth import get_user_model +from django.test import TestCase +from django.urls import reverse + +from ..api.tests import factories + + +class ReferentielijstenAdminTests(TestCase): + def setUp(self): + super().setUp() + self.client.force_login( + get_user_model()._default_manager.create( + username="root", is_superuser=True, is_staff=True + ) + ) + + def test_landadmin_indicatie_actief_true(self): + factories.LandFactory(ingangsdatum_land=datetime.date.today()) + url = reverse("admin:referentielijsten_land_changelist") + + response = self.client.get(url) + + self.assertContains( + response, + 'True', + ) + self.assertNotContains( + response, + 'False', + ) + + def test_landadmin_indicatie_actief_false(self): + tomorrow = datetime.date.today() + datetime.timedelta(days=1) + factories.LandFactory(ingangsdatum_land=tomorrow) + url = reverse("admin:referentielijsten_land_changelist") + + response = self.client.get(url) + + self.assertNotContains( + response, + 'True', + ) + self.assertContains( + response, + 'False', + )