summaryrefslogtreecommitdiff
path: root/yaksh/test_models.py
diff options
context:
space:
mode:
authormahesh2017-04-07 16:48:25 +0530
committermahesh2017-04-07 16:48:25 +0530
commitde2a369a4908046eef41f01537fd39442e14365c (patch)
tree6b0dd1067987af463e67defd60a559fc4b49a479 /yaksh/test_models.py
parenta9d7b48b6a5a79bf619500463d89f03e8ca1b7bb (diff)
parentad73f7b938b7620ab4be202dc33c699cf5cb4ac5 (diff)
downloadonline_test-de2a369a4908046eef41f01537fd39442e14365c.tar.gz
online_test-de2a369a4908046eef41f01537fd39442e14365c.tar.bz2
online_test-de2a369a4908046eef41f01537fd39442e14365c.zip
Merge branch 'master' of https://github.com/fossee/online_test into kill_stray_processes
Diffstat (limited to 'yaksh/test_models.py')
-rw-r--r--yaksh/test_models.py36
1 files changed, 36 insertions, 0 deletions
diff --git a/yaksh/test_models.py b/yaksh/test_models.py
index f8f506a..dbd367b 100644
--- a/yaksh/test_models.py
+++ b/yaksh/test_models.py
@@ -843,6 +843,29 @@ class CourseTestCases(unittest.TestCase):
self.quiz1 = Quiz.objects.get(description='demo quiz 1')
self.quiz2 = Quiz.objects.get(description='demo quiz 2')
+ # create courses with disabled enrollment
+ self.enroll_request_course = Course.objects.create(
+ name="Enrollment Request Course With Enrollment Disabled",
+ enrollment="Enroll Request",
+ creator=self.creator,
+ start_enroll_time=datetime(2015, 10, 9, 10, 8, 15, 0,
+ tzinfo=pytz.utc
+ ),
+ end_enroll_time=datetime(2015, 11, 9, 10, 8, 15, 0,
+ tzinfo=pytz.utc
+ ),
+ )
+ self.open_course = Course.objects.create(
+ name="Open Course With Enrollment Disabled",
+ enrollment="Open Course",
+ creator=self.creator,
+ start_enroll_time=datetime(2015, 10, 9, 10, 8, 15, 0,
+ tzinfo=pytz.utc
+ ),
+ end_enroll_time=datetime(2015, 11, 9, 10, 8, 15, 0,
+ tzinfo=pytz.utc
+ ),
+ )
def test_is_creator(self):
""" Test is_creator method of Course"""
@@ -926,6 +949,19 @@ class CourseTestCases(unittest.TestCase):
self.assertIn(self.creator, trial_course.students.all())
self.assertTrue(trial_course.is_trial)
+ def test_enabled_enrollment_for_course(self):
+ """Test to check enrollment is closed for open course"""
+ self.assertTrue(self.course.is_active_enrollment())
+
+ def test_disabled_enrollment_for_open_course(self):
+ """Test to check enrollment is closed for open course"""
+ self.assertFalse(self.open_course.is_active_enrollment())
+
+ def test_disabled_enrollment_for_enroll_request_course(self):
+ """Test to check enrollment is closed for open course"""
+ self.assertFalse(self.enroll_request_course.is_active_enrollment())
+
+
###############################################################################
class TestCaseTestCases(unittest.TestCase):