diff options
author | adityacp | 2018-02-28 16:54:22 +0530 |
---|---|---|
committer | adityacp | 2018-02-28 16:58:03 +0530 |
commit | 3bbaff2ebca026042cce3deb025effb9e83e0859 (patch) | |
tree | 071dab1d0a4097a0243cb6b9baf9f917693ab40d /yaksh/test_models.py | |
parent | 438f8657021981fc7b2e5adbacc13eb332a2e6d3 (diff) | |
download | online_test-3bbaff2ebca026042cce3deb025effb9e83e0859.tar.gz online_test-3bbaff2ebca026042cce3deb025effb9e83e0859.tar.bz2 online_test-3bbaff2ebca026042cce3deb025effb9e83e0859.zip |
Change forms.py, models.py, test_models.py and templates
- Add help text for timezone field in user registration form
- Add new method in course model to get days remaining to start a course
- Show start time and end time of a course to the students
- Disallow to enroll to a course which is not active
- Add model test for the new course method
Diffstat (limited to 'yaksh/test_models.py')
-rw-r--r-- | yaksh/test_models.py | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/yaksh/test_models.py b/yaksh/test_models.py index cd4279b..6cedc4b 100644 --- a/yaksh/test_models.py +++ b/yaksh/test_models.py @@ -1665,6 +1665,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_remain_to_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_remain_to_start(), actual_days) + self.course.start_enroll_time = course_time + self.course.save() + ############################################################################### class TestCaseTestCases(unittest.TestCase): |