From e7c18d17c8b5ed193e4e34bdfe2072951d996530 Mon Sep 17 00:00:00 2001 From: ankitjavalkar Date: Wed, 11 Jul 2018 17:19:56 +0530 Subject: Fix tests --- yaksh/test_models.py | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'yaksh/test_models.py') diff --git a/yaksh/test_models.py b/yaksh/test_models.py index 403dfb4..deb6654 100644 --- a/yaksh/test_models.py +++ b/yaksh/test_models.py @@ -1,4 +1,5 @@ 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,\ @@ -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,6 +114,7 @@ def tearDownModule(): LearningUnit.objects.all().delete() LearningModule.objects.all().delete() AnswerPaper.objects.all().delete() + Group.objects.all().delete() ############################################################################### -- cgit From 9e209521aa81631d940c3ca2010a9f373e4af09c Mon Sep 17 00:00:00 2001 From: ankitjavalkar Date: Thu, 12 Jul 2018 19:24:43 +0530 Subject: Add more tests --- yaksh/test_models.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'yaksh/test_models.py') diff --git a/yaksh/test_models.py b/yaksh/test_models.py index deb6654..14d5197 100644 --- a/yaksh/test_models.py +++ b/yaksh/test_models.py @@ -4,7 +4,7 @@ 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 ) @@ -117,6 +117,14 @@ def tearDownModule(): 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): def setUp(self): -- cgit