diff options
author | adityacp | 2021-01-25 13:12:56 +0530 |
---|---|---|
committer | adityacp | 2021-01-25 14:28:11 +0530 |
commit | 1e5c8af8748602d90a52f51d45799274155f8cd9 (patch) | |
tree | d51c46ee81866b7065f994b9e3c100457947312c /yaksh/test_views.py | |
parent | c474c68a2621e8c470ce2751103128fa793be62e (diff) | |
download | online_test-1e5c8af8748602d90a52f51d45799274155f8cd9.tar.gz online_test-1e5c8af8748602d90a52f51d45799274155f8cd9.tar.bz2 online_test-1e5c8af8748602d90a52f51d45799274155f8cd9.zip |
Fix views and models tests
Diffstat (limited to 'yaksh/test_views.py')
-rw-r--r-- | yaksh/test_views.py | 21 |
1 files changed, 16 insertions, 5 deletions
diff --git a/yaksh/test_views.py b/yaksh/test_views.py index 31066d1..89d209e 100644 --- a/yaksh/test_views.py +++ b/yaksh/test_views.py @@ -4955,6 +4955,14 @@ class TestDownloadCsv(TestCase): total_marks=1.0, fixed_question_order=str(self.question.id) ) self.question_paper.fixed_questions.add(self.question) + self.learning_unit = LearningUnit.objects.create( + order=1, type="quiz", quiz=self.quiz) + self.learning_module = LearningModule.objects.create( + order=1, name="download module", description="download module", + check_prerequisite=False, creator=self.user) + self.learning_module.learning_unit.add(self.learning_unit.id) + self.course.learning_module.add(self.learning_module) + # student answerpaper user_answer = "def add(a, b)\n\treturn a+b" @@ -5056,7 +5064,9 @@ class TestDownloadCsv(TestCase): kwargs={'course_id': self.course.id}), follow=True ) - file_name = "{0}.csv".format(self.course.name.lower()) + file_name = "{0}.csv".format( + self.course.name.replace(" ", "_").lower() + ) self.assertEqual(response.status_code, 200) self.assertEqual(response.get('Content-Disposition'), 'attachment; filename="{0}"'.format(file_name)) @@ -5089,15 +5099,16 @@ class TestDownloadCsv(TestCase): username=self.user.username, password=self.user_plaintext_pass ) - response = self.client.get( + response = self.client.post( reverse('yaksh:download_quiz_csv', kwargs={"course_id": self.course.id, "quiz_id": self.quiz.id}), + data={"attempt_number": 1}, follow=True ) - file_name = "{0}-{1}-attempt{2}.csv".format( - self.course.name.replace('.', ''), - self.quiz.description.replace('.', ''), 1 + 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'), |