summaryrefslogtreecommitdiff
path: root/yaksh/test_models.py
diff options
context:
space:
mode:
authoradityacp2017-03-09 18:38:16 +0530
committeradityacp2017-03-10 15:41:07 +0530
commit97abdf46bad713e1ddab31175fbb7030e0257acb (patch)
tree9a66261d519262b673406318b14a3b3814ade038 /yaksh/test_models.py
parentca3c488193a7321b0ed0986856c4e74feadc199c (diff)
downloadonline_test-97abdf46bad713e1ddab31175fbb7030e0257acb.tar.gz
online_test-97abdf46bad713e1ddab31175fbb7030e0257acb.tar.bz2
online_test-97abdf46bad713e1ddab31175fbb7030e0257acb.zip
Add test for ordering of questions
Diffstat (limited to 'yaksh/test_models.py')
-rw-r--r--yaksh/test_models.py11
1 files changed, 9 insertions, 2 deletions
diff --git a/yaksh/test_models.py b/yaksh/test_models.py
index 80a385f..5e39ab9 100644
--- a/yaksh/test_models.py
+++ b/yaksh/test_models.py
@@ -1,7 +1,7 @@
import unittest
from yaksh.models import User, Profile, Question, Quiz, QuestionPaper,\
QuestionSet, AnswerPaper, Answer, Course, StandardTestCase,\
- StdIOBasedTestCase, FileUpload, McqTestCases
+ StdIOBasedTestCase, FileUpload, McqTestCase
import json
from datetime import datetime, timedelta
from django.utils import timezone
@@ -324,6 +324,9 @@ class QuestionPaperTestCases(unittest.TestCase):
shuffle_questions=True
)
+ self.question_paper.fixed_question_order = "{0}, {1}".format(
+ self.questions[3].id, self.questions[5].id
+ )
# add fixed set of questions to the question paper
self.question_paper.fixed_questions.add(self.questions[3],
self.questions[5]
@@ -417,7 +420,6 @@ class QuestionPaperTestCases(unittest.TestCase):
attempt_num)
self.assertIsInstance(answerpaper, AnswerPaper)
paper_questions = answerpaper.questions.all()
- print (paper_questions)
self.assertEqual(len(paper_questions), 7)
fixed_questions = set(self.question_paper.fixed_questions.all())
self.assertTrue(fixed_questions.issubset(set(paper_questions)))
@@ -450,6 +452,11 @@ class QuestionPaperTestCases(unittest.TestCase):
'id', flat=True)
self.assertEqual(self.questions_list, fixed_q)
+ def test_fixed_order_questions(self):
+ fixed_ques = self.question_paper.get_ordered_questions()
+ actual_ques = [self.questions[3], self.questions[5]]
+ self.assertSequenceEqual(fixed_ques, actual_ques)
+
###############################################################################
class AnswerPaperTestCases(unittest.TestCase):