diff options
author | adityacp | 2018-01-18 14:21:05 +0530 |
---|---|---|
committer | adityacp | 2018-01-18 14:21:58 +0530 |
commit | 9f0724354ae2801be02c5c8b8762d76ef6ce589d (patch) | |
tree | 3afff6a6c4e608542cdcad070bbeb4840edb406a /yaksh/test_views.py | |
parent | 6e9fa57333261f2ef1e38f1de9f88e0daeed32da (diff) | |
parent | 1445358b4ee548edd16a8d42026b080b7d92a0c4 (diff) | |
download | online_test-9f0724354ae2801be02c5c8b8762d76ef6ce589d.tar.gz online_test-9f0724354ae2801be02c5c8b8762d76ef6ce589d.tar.bz2 online_test-9f0724354ae2801be02c5c8b8762d76ef6ce589d.zip |
Update to latest changes from master
Diffstat (limited to 'yaksh/test_views.py')
-rw-r--r-- | yaksh/test_views.py | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/yaksh/test_views.py b/yaksh/test_views.py index b4531a6..5c1c475 100644 --- a/yaksh/test_views.py +++ b/yaksh/test_views.py @@ -2138,6 +2138,11 @@ class TestCourseDetail(TestCase): self.user1_course = Course.objects.create(name="Python Course", enrollment="Enroll Request", creator=self.user1) + self.learning_module = LearningModule.objects.create( + name="test module", description="test description module", + html_data="test html description module", creator=self.user1, + order=1) + self.user1_course.learning_module.add(self.learning_module) def tearDown(self): self.client.logout() @@ -2524,6 +2529,30 @@ class TestCourseDetail(TestCase): self.assertEqual(response.get('Content-Disposition'), 'attachment; filename="sample_user_upload"') + def test_view_course_status(self): + """ Test to view course status """ + self.client.login( + username=self.student.username, + password=self.student_plaintext_pass + ) + + # Denies student to view course status + response = self.client.get(reverse('yaksh:course_status', + kwargs={'course_id': self.user1_course.id})) + self.assertEqual(response.status_code, 404) + + # Moderator Login + self.client.login( + username=self.user1.username, + password=self.user1_plaintext_pass + ) + response = self.client.get(reverse('yaksh:course_status', + kwargs={'course_id': self.user1_course.id})) + self.assertEqual(response.status_code, 200) + self.assertEqual(response.context['state'], "course_status") + self.assertEqual(response.context['course'], self.user1_course) + self.assertEqual(response.context['modules'][0], self.learning_module) + class TestEnrollRequest(TestCase): def setUp(self): |