diff options
author | adityacp | 2017-10-06 18:01:25 +0530 |
---|---|---|
committer | adityacp | 2017-10-06 18:01:25 +0530 |
commit | bf17148a234b77a4a4521d34e17afddb3cd34914 (patch) | |
tree | 5787e2fd829637fa167861011896317d833a79a1 /yaksh/test_models.py | |
parent | 9c6472c4a677248bc0f2de2a513368dc68d11f05 (diff) | |
download | online_test-bf17148a234b77a4a4521d34e17afddb3cd34914.tar.gz online_test-bf17148a234b77a4a4521d34e17afddb3cd34914.tar.bz2 online_test-bf17148a234b77a4a4521d34e17afddb3cd34914.zip |
Add test for shuffle questions and fix broken tests in test_views
Diffstat (limited to 'yaksh/test_models.py')
-rw-r--r-- | yaksh/test_models.py | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/yaksh/test_models.py b/yaksh/test_models.py index e3ef86e..03af521 100644 --- a/yaksh/test_models.py +++ b/yaksh/test_models.py @@ -597,8 +597,8 @@ class AnswerPaperTestCases(unittest.TestCase): self.question_paper2 = QuestionPaper( quiz=self.quiz2, total_marks=3, shuffle_questions=True) self.question_paper2.save() - - que_list = Question.objects.filter(id__in=range(1, 21)) + summary_list = ['Q%d' % (i) for i in range(1, 21)] + que_list = Question.objects.filter(summary__in=summary_list) self.question_paper2.fixed_questions.add(*que_list) # Create AnswerPaper for user1 and user2 @@ -877,9 +877,8 @@ class AnswerPaperTestCases(unittest.TestCase): self.assertEqual(latest_answer.answer, "answer1") def test_shuffle_questions(self): - ques_set_1 = list(self.user1_answerpaper.questions.all()) - ques_set_2 = list(self.user2_answerpaper.questions.all()) - print("set1:-", ques_set_1, "\n", "set2:-", ques_set_2) + ques_set_1 = self.user1_answerpaper.get_all_ordered_questions() + ques_set_2 = self.user2_answerpaper.get_all_ordered_questions() self.assertFalse(ques_set_1 == ques_set_2) |