diff options
author | adityacp | 2017-03-09 18:38:16 +0530 |
---|---|---|
committer | adityacp | 2017-03-10 15:41:07 +0530 |
commit | 97abdf46bad713e1ddab31175fbb7030e0257acb (patch) | |
tree | 9a66261d519262b673406318b14a3b3814ade038 /yaksh | |
parent | ca3c488193a7321b0ed0986856c4e74feadc199c (diff) | |
download | online_test-97abdf46bad713e1ddab31175fbb7030e0257acb.tar.gz online_test-97abdf46bad713e1ddab31175fbb7030e0257acb.tar.bz2 online_test-97abdf46bad713e1ddab31175fbb7030e0257acb.zip |
Add test for ordering of questions
Diffstat (limited to 'yaksh')
-rw-r--r-- | yaksh/test_models.py | 11 |
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): |