summaryrefslogtreecommitdiff
path: root/yaksh/test_views.py
diff options
context:
space:
mode:
authoradityacp2018-02-08 11:56:11 +0530
committeradityacp2018-02-08 11:56:11 +0530
commite1b60921ba995148e0741637011651eb21eb49be (patch)
tree23244170180a12650590a7089de12607c620610a /yaksh/test_views.py
parente1f4ffc3ab43d02115e6c496bf08bea1e52af2ef (diff)
downloadonline_test-e1b60921ba995148e0741637011651eb21eb49be.tar.gz
online_test-e1b60921ba995148e0741637011651eb21eb49be.tar.bz2
online_test-e1b60921ba995148e0741637011651eb21eb49be.zip
Change in test_views and test_models
- Add views test to check active status for lesson and learning module - Change models test for module get_status method
Diffstat (limited to 'yaksh/test_views.py')
-rw-r--r--yaksh/test_views.py24
1 files changed, 24 insertions, 0 deletions
diff --git a/yaksh/test_views.py b/yaksh/test_views.py
index 9be8d13..3b27338 100644
--- a/yaksh/test_views.py
+++ b/yaksh/test_views.py
@@ -5079,6 +5079,30 @@ class TestLessons(TestCase):
self.assertEqual(response.status_code, 200)
self.assertEqual(response.context["msg"], err_msg)
+ # Check if lesson is active
+ self.lesson.active = False
+ self.lesson.save()
+ response = self.client.get(
+ reverse('yaksh:show_lesson',
+ kwargs={"lesson_id": self.lesson.id,
+ "module_id": self.learning_module.id,
+ "course_id": self.course.id}))
+ err_msg = "{0} is not active".format(self.lesson.name)
+ self.assertEqual(response.status_code, 200)
+ self.assertEqual(response.context["msg"], err_msg)
+
+ # Check if module is active
+ self.learning_module2.active = False
+ self.learning_module2.save()
+ response = self.client.get(
+ reverse('yaksh:show_lesson',
+ kwargs={"lesson_id": self.lesson2.id,
+ "module_id": self.learning_module2.id,
+ "course_id": self.course.id}))
+ err_msg = "{0} is not active".format(self.learning_module2.name)
+ self.assertEqual(response.status_code, 200)
+ self.assertEqual(response.context["msg"], err_msg)
+
def test_show_all_lessons(self):
""" Moderator should be able to see all created lessons"""
self.client.login(