summaryrefslogtreecommitdiff
path: root/yaksh/test_models.py
diff options
context:
space:
mode:
authorKing2018-07-13 01:44:00 -0700
committerGitHub2018-07-13 01:44:00 -0700
commitf0f4a882a796319f766ff67cd3f8133a04054dfd (patch)
treea5c8a3ab617107743864f9faacad341d0e74da00 /yaksh/test_models.py
parent661c9d82bb680e745cc6b498131a0793b954c436 (diff)
parent0af47ee9292132ab472e3e0bbae617d77437ff72 (diff)
downloadonline_test-f0f4a882a796319f766ff67cd3f8133a04054dfd.tar.gz
online_test-f0f4a882a796319f766ff67cd3f8133a04054dfd.tar.bz2
online_test-f0f4a882a796319f766ff67cd3f8133a04054dfd.zip
Merge pull request #480 from ankitjavalkar/toggle-mod
[Role based implementation] Allow moderator to switch between student and moderator roles
Diffstat (limited to 'yaksh/test_models.py')
-rw-r--r--yaksh/test_models.py14
1 files changed, 13 insertions, 1 deletions
diff --git a/yaksh/test_models.py b/yaksh/test_models.py
index 403dfb4..14d5197 100644
--- a/yaksh/test_models.py
+++ b/yaksh/test_models.py
@@ -1,9 +1,10 @@
import unittest
+from django.contrib.auth.models import Group
from yaksh.models import User, Profile, Question, Quiz, QuestionPaper,\
QuestionSet, AnswerPaper, Answer, Course, StandardTestCase,\
StdIOBasedTestCase, FileUpload, McqTestCase, AssignmentUpload,\
LearningModule, LearningUnit, Lesson, LessonFile, CourseStatus, \
- TestCaseOrder
+ TestCaseOrder, create_group
from yaksh.code_server import (
ServerPool, get_result as get_result_from_code_server
)
@@ -24,6 +25,8 @@ from yaksh import settings
def setUpModule():
+ mod_group = Group.objects.create(name='moderator')
+
# create user profile
user = User.objects.create_user(username='creator',
password='demo',
@@ -111,7 +114,16 @@ def tearDownModule():
LearningUnit.objects.all().delete()
LearningModule.objects.all().delete()
AnswerPaper.objects.all().delete()
+ Group.objects.all().delete()
+
+###############################################################################
+class GlobalMethodsTestCases(unittest.TestCase):
+ def test_create_group_when_group_exists(self):
+ self.assertEqual(
+ create_group('moderator', 'yaksh'),
+ Group.objects.get(name='moderator')
+ )
###############################################################################
class LessonTestCases(unittest.TestCase):