diff options
Diffstat (limited to 'yaksh/test_views.py')
-rw-r--r-- | yaksh/test_views.py | 29 |
1 files changed, 18 insertions, 11 deletions
diff --git a/yaksh/test_views.py b/yaksh/test_views.py index 3520c61..5a14573 100644 --- a/yaksh/test_views.py +++ b/yaksh/test_views.py @@ -951,10 +951,12 @@ class TestDownloadAssignment(TestCase): SimpleUploadedFile("file3.txt", b"Test") self.assignment1 = AssignmentUpload.objects.create( user=self.student1, assignmentQuestion=self.question, + course=self.course, assignmentFile=assignment_file1, question_paper=self.question_paper ) self.assignment2 = AssignmentUpload.objects.create( user=self.student2, assignmentQuestion=self.question, + course=self.course, assignmentFile=assignment_file2, question_paper=self.question_paper ) @@ -977,16 +979,18 @@ class TestDownloadAssignment(TestCase): def test_download_assignment_denies_student(self): """ - Check download assignment denies student + Check download assignment denies student not enrolled in a course """ self.client.login( username=self.student1.username, password=self.student1_plaintext_pass ) - response = self.client.get(reverse('yaksh:download_quiz_assignment', - kwargs={'quiz_id': self.quiz.id}), - follow=True - ) + response = self.client.get( + reverse('yaksh:download_quiz_assignment', + kwargs={'quiz_id': self.quiz.id, + "course_id": self.course.id}), + follow=True + ) self.assertEqual(response.status_code, 404) def test_download_assignment_per_quiz(self): @@ -997,11 +1001,13 @@ class TestDownloadAssignment(TestCase): username=self.user.username, password=self.user_plaintext_pass ) - response = self.client.get(reverse('yaksh:download_quiz_assignment', - kwargs={'quiz_id': self.quiz.id}), - follow=True - ) - file_name = "{0}_Assignment_files.zip".format(self.quiz.description) + response = self.client.get( + reverse('yaksh:download_quiz_assignment', + kwargs={'quiz_id': self.quiz.id, + 'course_id': self.course.id}), + follow=True + ) + file_name = "{0}_Assignment_files.zip".format(self.course.name) file_name = file_name.replace(" ", "_") self.assertEqual(response.status_code, 200) self.assertEqual(response.get('Content-Disposition'), @@ -1026,7 +1032,8 @@ class TestDownloadAssignment(TestCase): reverse('yaksh:download_user_assignment', kwargs={'quiz_id': self.quiz.id, 'question_id': self.question.id, - 'user_id': self.student2.id + 'user_id': self.student2.id, + 'course_id': self.course.id }), follow=True ) |