summaryrefslogtreecommitdiff
path: root/yaksh/test_models.py
diff options
context:
space:
mode:
authormaheshgudi2018-03-21 19:14:09 +0530
committermaheshgudi2018-03-21 19:14:09 +0530
commit09ab00808ba9ea288047662e5c7ee2a134f0ac41 (patch)
treeb9ad94f07ae3891295656203c169cb0b03b08d96 /yaksh/test_models.py
parentefeeaae745f32c4da34f91ca3618d7c3441a5f32 (diff)
parent4b356aa2f6097cd0f46292218f31ded18b631e53 (diff)
downloadonline_test-09ab00808ba9ea288047662e5c7ee2a134f0ac41.tar.gz
online_test-09ab00808ba9ea288047662e5c7ee2a134f0ac41.tar.bz2
online_test-09ab00808ba9ea288047662e5c7ee2a134f0ac41.zip
Merge branch 'master' of https://github.com/fossee/online_test into arrange_options
Diffstat (limited to 'yaksh/test_models.py')
-rw-r--r--yaksh/test_models.py18
1 files changed, 18 insertions, 0 deletions
diff --git a/yaksh/test_models.py b/yaksh/test_models.py
index 39a90d1..e7a6fe5 100644
--- a/yaksh/test_models.py
+++ b/yaksh/test_models.py
@@ -1684,6 +1684,24 @@ class CourseTestCases(unittest.TestCase):
updated_percent = self.course.percent_completed(self.student1)
self.assertEqual(updated_percent, 25)
+ def test_course_time_remaining_to_start(self):
+ # check if course has 0 days left to start
+ self.assertEqual(self.course.days_before_start(), 0)
+
+ # check if course has some days left to start
+ course_time = self.course.start_enroll_time
+ self.course.start_enroll_time = datetime(
+ 2199, 12, 31, 10, 8, 15, 0,
+ tzinfo=pytz.utc
+ )
+ self.course.save()
+ updated_course = Course.objects.get(id=self.course.id)
+ time_diff = updated_course.start_enroll_time - timezone.now()
+ actual_days = time_diff.days + 1
+ self.assertEqual(updated_course.days_before_start(), actual_days)
+ self.course.start_enroll_time = course_time
+ self.course.save()
+
###############################################################################
class TestCaseTestCases(unittest.TestCase):