diff options
author | adityacp | 2018-01-19 12:04:08 +0530 |
---|---|---|
committer | adityacp | 2018-01-19 12:22:09 +0530 |
commit | 6da1f77a6a1a2bffb85d5395f2703f186b18cb4a (patch) | |
tree | 73b2339ffda3002011a9548b7b60eb279920dfeb /yaksh/test_views.py | |
parent | 9f0724354ae2801be02c5c8b8762d76ef6ce589d (diff) | |
download | online_test-6da1f77a6a1a2bffb85d5395f2703f186b18cb4a.tar.gz online_test-6da1f77a6a1a2bffb85d5395f2703f186b18cb4a.tar.bz2 online_test-6da1f77a6a1a2bffb85d5395f2703f186b18cb4a.zip |
Improve views test case for questionpaper
Diffstat (limited to 'yaksh/test_views.py')
-rw-r--r-- | yaksh/test_views.py | 24 |
1 files changed, 20 insertions, 4 deletions
diff --git a/yaksh/test_views.py b/yaksh/test_views.py index 5c1c475..dad5e89 100644 --- a/yaksh/test_views.py +++ b/yaksh/test_views.py @@ -4064,9 +4064,6 @@ class TestQuestionPaper(TestCase): name="Python Course", enrollment="Open Enrollment", creator=self.user) - # Add teacher to the course - self.course.teachers.add(self.teacher) - self.quiz = Quiz.objects.create( start_date_time=datetime(2014, 10, 9, 10, 8, 15, 0, tzone), end_date_time=datetime(2015, 10, 9, 10, 8, 15, 0, tzone), @@ -4475,12 +4472,31 @@ class TestQuestionPaper(TestCase): "questionpaper_id": self.question_paper.id})) self.assertEqual(response.status_code, 404) - # Should allow course teacher to edit question paper self.client.login( username=self.teacher.username, password=self.teacher_plaintext_pass ) + # Should not allow teacher to view question paper + response = self.client.get( + reverse('yaksh:designquestionpaper', + kwargs={"quiz_id": self.quiz.id, + "questionpaper_id": self.question_paper.id})) + + self.assertEqual(response.status_code, 404) + + # Should not allow teacher to view question paper + response = self.client.get( + reverse('yaksh:designquestionpaper', + kwargs={"quiz_id": self.quiz.id, + "course_id": self.course.id, + "questionpaper_id": self.question_paper.id})) + + self.assertEqual(response.status_code, 404) + + # Should allow course teacher to view question paper + # Add teacher to the course + self.course.teachers.add(self.teacher) response = self.client.get( reverse('yaksh:designquestionpaper', kwargs={"quiz_id": self.quiz.id, |