-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
dd55ebd
commit 1ec55cd
Showing
2 changed files
with
48 additions
and
0 deletions.
There are no files selected for viewing
Empty file.
48 changes: 48 additions & 0 deletions
48
src/openklant/components/referentielijsten/tests/test_admin.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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, | ||
'<td class="field-indicatie_actief"><img src="/static/admin/img/icon-yes.svg" alt="True"></td>', | ||
) | ||
self.assertNotContains( | ||
response, | ||
'<td class="field-indicatie_actief"><img src="/static/admin/img/icon-no.svg" alt="False"></td>', | ||
) | ||
|
||
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, | ||
'<td class="field-indicatie_actief"><img src="/static/admin/img/icon-yes.svg" alt="True"></td>', | ||
) | ||
self.assertContains( | ||
response, | ||
'<td class="field-indicatie_actief"><img src="/static/admin/img/icon-no.svg" alt="False"></td>', | ||
) |