diff options
author | Prabhu Ramachandran | 2016-05-04 11:13:10 +0530 |
---|---|---|
committer | Prabhu Ramachandran | 2016-05-04 11:13:10 +0530 |
commit | 03f0aa839e4d91a3d83d68d5301f1425f18cca73 (patch) | |
tree | 26ba7a6d92878844a25d988cb57112f287b7a85c /yaksh/tests.py | |
parent | 825f8464ef1b2853c029cc23bf7fb89f6a9c1c09 (diff) | |
parent | 78795446d89ae5c247f5424d70d652437c93cda6 (diff) | |
download | online_test-03f0aa839e4d91a3d83d68d5301f1425f18cca73.tar.gz online_test-03f0aa839e4d91a3d83d68d5301f1425f18cca73.tar.bz2 online_test-03f0aa839e4d91a3d83d68d5301f1425f18cca73.zip |
Merge pull request #92 from adityacp/Add_Teachers
Add teachers to a course
Diffstat (limited to 'yaksh/tests.py')
-rw-r--r-- | yaksh/tests.py | 25 |
1 files changed, 21 insertions, 4 deletions
diff --git a/yaksh/tests.py b/yaksh/tests.py index d6d1d91..cc3100e 100644 --- a/yaksh/tests.py +++ b/yaksh/tests.py @@ -3,7 +3,7 @@ from yaksh.models import User, Profile, Question, Quiz, QuestionPaper,\ QuestionSet, AnswerPaper, Answer, TestCase, Course import json from datetime import datetime, timedelta - +from django.contrib.auth.models import Group def setUpModule(): # create user profile @@ -55,19 +55,19 @@ def tearDownModule(): ############################################################################### class ProfileTestCases(unittest.TestCase): def setUp(self): - self.user = User.objects.get(pk=1) + self.user1 = User.objects.get(pk=1) self.profile = Profile.objects.get(pk=1) + self.user2 = User.objects.get(pk=3) def test_user_profile(self): """ Test user profile""" - self.assertEqual(self.user.username, 'demo_user') + self.assertEqual(self.user1.username, 'demo_user') self.assertEqual(self.profile.user.username, 'demo_user') self.assertEqual(int(self.profile.roll_number), 1) self.assertEqual(self.profile.institute, 'IIT') self.assertEqual(self.profile.department, 'Chemical') self.assertEqual(self.profile.position, 'Student') - ############################################################################### class QuestionTestCases(unittest.TestCase): def setUp(self): @@ -437,3 +437,20 @@ class CourseTestCases(unittest.TestCase): def test_get_quizzes(self): """ Test get_quizzes method of Courses""" self.assertSequenceEqual(self.course.get_quizzes(), [self.quiz1, self.quiz2]) + + def test_add_teachers(self): + """ Test to add teachers to a course""" + self.course.add_teachers(self.student1, self.student2) + self.assertSequenceEqual(self.course.get_teachers(), [self.student1, self.student2]) + + def test_remove_teachers(self): + """ Test to remove teachers from a course""" + self.course.add_teachers(self.student1, self.student2) + self.course.remove_teachers(self.student1) + self.assertSequenceEqual(self.course.get_teachers(), [self.student2]) + + def test_is_teacher(self): + """ Test to check if user is teacher""" + self.course.add_teachers(self.student2) + result = self.course.is_teacher(self.student2) + self.assertTrue(result) |