diff options
author | Prabhu Ramachandran | 2017-11-07 19:28:42 +0530 |
---|---|---|
committer | GitHub | 2017-11-07 19:28:42 +0530 |
commit | e65b605e59c1384ad9607c99484107929248f220 (patch) | |
tree | 798dc730344fa6ea16f1c81b981c218ea5e6abd9 /yaksh/test_views.py | |
parent | a89ddbacb3b3cf48168281cb41ea61b127c9410c (diff) | |
parent | 2eee8fa300a4776647a7be7fdb9dee082f4d6fd8 (diff) | |
download | online_test-e65b605e59c1384ad9607c99484107929248f220.tar.gz online_test-e65b605e59c1384ad9607c99484107929248f220.tar.bz2 online_test-e65b605e59c1384ad9607c99484107929248f220.zip |
Merge pull request #373 from prathamesh920/detailed_csv_download_quiz
Detailed csv download quiz
Diffstat (limited to 'yaksh/test_views.py')
-rw-r--r-- | yaksh/test_views.py | 20 |
1 files changed, 13 insertions, 7 deletions
diff --git a/yaksh/test_views.py b/yaksh/test_views.py index 0950785..e3b0168 100644 --- a/yaksh/test_views.py +++ b/yaksh/test_views.py @@ -2936,6 +2936,7 @@ class TestDownloadcsv(TestCase): self.mod_group.user_set.add(self.user) self.course = Course.objects.create(name="Python Course", enrollment="Enroll Request", creator=self.user) + self.course.students.add(self.student) self.quiz = Quiz.objects.create( start_date_time=datetime(2014, 10, 9, 10, 8, 15, 0, tzone), @@ -2988,8 +2989,9 @@ class TestDownloadcsv(TestCase): username=self.student.username, password=self.student_plaintext_pass ) - response = self.client.get(reverse('yaksh:download_csv', - kwargs={"questionpaper_id": self.question_paper.id}), + response = self.client.get(reverse('yaksh:download_quiz_csv', + kwargs={"course_id": self.course.id, + "quiz_id": self.quiz.id}), follow=True ) self.assertEqual(response.status_code, 404) @@ -3017,8 +3019,9 @@ class TestDownloadcsv(TestCase): username=self.student.username, password=self.student_plaintext_pass ) - response = self.client.get(reverse('yaksh:download_csv', - kwargs={"questionpaper_id": self.question_paper.id}), + response = self.client.get(reverse('yaksh:download_quiz_csv', + kwargs={"course_id": self.course.id, + "quiz_id": self.quiz.id}), follow=True ) self.assertEqual(response.status_code, 404) @@ -3063,11 +3066,14 @@ class TestDownloadcsv(TestCase): username=self.user.username, password=self.user_plaintext_pass ) - response = self.client.get(reverse('yaksh:download_csv', - kwargs={'questionpaper_id': self.question_paper.id}), + response = self.client.get(reverse('yaksh:download_quiz_csv', + kwargs={"course_id": self.course.id, + "quiz_id": self.quiz.id}), + follow=True ) - file_name = "{0}.csv".format(self.quiz.description) + file_name = "{0}-{1}-attempt{2}.csv".format(self.course.name.replace('.', ''), + self.quiz.description.replace('.', ''), 1) self.assertEqual(response.status_code, 200) self.assertEqual(response.get('Content-Disposition'), 'attachment; filename="{0}"'.format(file_name)) |