summaryrefslogtreecommitdiff
path: root/yaksh/test_models.py
diff options
context:
space:
mode:
authoradityacp2018-02-09 14:56:02 +0530
committeradityacp2018-02-15 14:52:19 +0530
commit617d09ca9b05185d9a2310c106360091ed8a1b1a (patch)
tree81a679abd29cbe8b9c5cafd447597a0e116014b3 /yaksh/test_models.py
parent93c4469db46ca0df19dbcf33eb7e8f6fad4f5b7b (diff)
downloadonline_test-617d09ca9b05185d9a2310c106360091ed8a1b1a.tar.gz
online_test-617d09ca9b05185d9a2310c106360091ed8a1b1a.tar.bz2
online_test-617d09ca9b05185d9a2310c106360091ed8a1b1a.zip
Change in models, test_models and views
- Change learning module test to remove units from course status after successful test run - Remove unnecessary comments from views - Remove unnecessary condition from module get_status method
Diffstat (limited to 'yaksh/test_models.py')
-rw-r--r--yaksh/test_models.py9
1 files changed, 8 insertions, 1 deletions
diff --git a/yaksh/test_models.py b/yaksh/test_models.py
index d6fac96..8205b88 100644
--- a/yaksh/test_models.py
+++ b/yaksh/test_models.py
@@ -140,6 +140,11 @@ class LearningModuleTestCases(unittest.TestCase):
self.course_status = CourseStatus.objects.get(
course=self.course, user=self.student)
+ def tearDown(self):
+ # Remove unit from course status completed units
+ self.course_status.completed_units.remove(self.learning_unit_one)
+ self.course_status.completed_units.remove(self.learning_unit_two)
+
def test_learning_module(self):
self.assertEqual(self.learning_module.description, 'module one')
self.assertEqual(self.learning_module.creator, self.creator)
@@ -199,7 +204,7 @@ class LearningModuleTestCases(unittest.TestCase):
# Then
self.assertEqual(unit, next_unit)
- def test_get_status(self):
+ def test_get_module_status(self):
# Given
module_status = 'not attempted'
# When
@@ -238,6 +243,8 @@ class LearningModuleTestCases(unittest.TestCase):
self.assertEqual(percent, 0)
# for module with learning units
+ self.course_status.completed_units.add(self.learning_unit_one)
+ self.course_status.completed_units.add(self.learning_unit_two)
percent = self.learning_module.get_module_complete_percent(
self.course, self.student
)