Skip to content

Commit

Permalink
chore: Add test for responses download with project that has no quest…
Browse files Browse the repository at this point in the history
…ionnaire configured.
  • Loading branch information
Nico-AP committed Feb 9, 2025
1 parent 39edfaa commit 83fbc56
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions ddm/apis/tests/test_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,11 @@ def setUpTestData(cls):
slug='base',
owner=base_profile
)
cls.project_no_quest = DonationProject.objects.create(
name='Project no Questionnaire',
slug='no-quest',
owner=base_profile
)
cls.project_alt = DonationProject.objects.create(
name='Alt Project',
slug='alternative',
Expand Down Expand Up @@ -354,6 +359,20 @@ def test_responses_api_get_csv_with_valid_api_credentials(self):
self.assertEqual(response.status_code, 200)
self.assertEqual(response['Content-Type'], 'text/csv')

def test_responses_api_get_csv_with_no_questionnaire(self):
token = self.project_no_quest.create_token() # TODO: Change to no
client = APIClient()
client.credentials(HTTP_AUTHORIZATION='Token ' + token.key)
url = reverse(
'ddm_apis:responses',
args=[self.project_no_quest.url_id]
)
query_string = f'?csv=true'
response = client.get(url + query_string)
self.assertEqual(response.status_code, 200)
self.assertEqual(response['Content-Type'], 'text/csv')


def test_participant_deletion_with_regular_login(self):
self.client.login(**self.base_creds)

Expand Down

0 comments on commit 83fbc56

Please sign in to comment.