summaryrefslogtreecommitdiff
path: root/yaksh/test_views.py
diff options
context:
space:
mode:
authorPrabhu Ramachandran2018-01-15 12:23:52 +0530
committerGitHub2018-01-15 12:23:52 +0530
commit1445358b4ee548edd16a8d42026b080b7d92a0c4 (patch)
tree99b437d71f841cb1ac9f26266d7e7de04031f340 /yaksh/test_views.py
parent3abbc557c57eaf2f3d08222034f9a720a1e7a1ed (diff)
parentef22478a11d518982f38a6a0d4d84f6f8ba5e492 (diff)
downloadonline_test-1445358b4ee548edd16a8d42026b080b7d92a0c4.tar.gz
online_test-1445358b4ee548edd16a8d42026b080b7d92a0c4.tar.bz2
online_test-1445358b4ee548edd16a8d42026b080b7d92a0c4.zip
Merge pull request #422 from adityacp/show_course_status
Show course status
Diffstat (limited to 'yaksh/test_views.py')
-rw-r--r--yaksh/test_views.py29
1 files changed, 29 insertions, 0 deletions
diff --git a/yaksh/test_views.py b/yaksh/test_views.py
index 71d6f80..343e043 100644
--- a/yaksh/test_views.py
+++ b/yaksh/test_views.py
@@ -2089,6 +2089,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()
@@ -2475,6 +2480,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):