summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoradityacp2018-07-17 15:37:57 +0530
committeradityacp2018-07-17 15:37:57 +0530
commit49b2be625f2a79b87e1b51f13fdf8c9300cf690c (patch)
tree5b626d5f941888250b3c68367b279e59752290d0
parent8902f96f28ead9f2ed158691e582f09c8366dfcd (diff)
downloadonline_test-49b2be625f2a79b87e1b51f13fdf8c9300cf690c.tar.gz
online_test-49b2be625f2a79b87e1b51f13fdf8c9300cf690c.tar.bz2
online_test-49b2be625f2a79b87e1b51f13fdf8c9300cf690c.zip
Change views tests for assignment uploads
-rw-r--r--yaksh/test_views.py29
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
)