-
Notifications
You must be signed in to change notification settings - Fork 14
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
Showing
2 changed files
with
76 additions
and
1 deletion.
There are no files selected for viewing
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
26 changes: 26 additions & 0 deletions
26
aidants_connect_habilitation/tests/test_admin_resources.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,26 @@ | ||
from django.contrib.admin.sites import AdminSite | ||
from django.test import TestCase, tag | ||
from django.test.client import RequestFactory | ||
|
||
from aidants_connect_habilitation.admin import OrganisationRequestAdmin | ||
from aidants_connect_habilitation.models import OrganisationRequest | ||
from aidants_connect_habilitation.tests.factories import OrganisationRequestFactory | ||
|
||
|
||
@tag("admin") | ||
class OrganisationRequestResourceTestCase(TestCase): | ||
|
||
@classmethod | ||
def setUpTestData(cls): | ||
cls.rf = RequestFactory() | ||
cls.orga_request_1 = OrganisationRequestFactory(name="MAIRIE 1") | ||
cls.orga_request_2 = OrganisationRequestFactory(name="MAIRIE 2") | ||
|
||
def test_export_organisation_request(self): | ||
request = self.rf.get("/", {}) | ||
orga_requests = OrganisationRequest.objects.all() | ||
orga_request_admin = OrganisationRequestAdmin(OrganisationRequest, AdminSite()) | ||
data = orga_request_admin.get_data_for_export(request, orga_requests) | ||
self.assertEqual(len(data), 2) | ||
self.assertEqual(data[0][3], "MAIRIE 1") | ||
self.assertEqual(data[1][3], "MAIRIE 2") |