diff options
author | adityacp | 2017-10-05 17:07:41 +0530 |
---|---|---|
committer | adityacp | 2017-10-06 12:44:34 +0530 |
commit | 474fc2c54eda0e8c890ea17b791b2fe74d07c611 (patch) | |
tree | 3fd3644d9af7c8b0cdf990a0aad00c00156d77c7 /yaksh/test_models.py | |
parent | 3038ab21bc93b3dfebda82a10fc179dadb488bf3 (diff) | |
download | online_test-474fc2c54eda0e8c890ea17b791b2fe74d07c611.tar.gz online_test-474fc2c54eda0e8c890ea17b791b2fe74d07c611.tar.bz2 online_test-474fc2c54eda0e8c890ea17b791b2fe74d07c611.zip |
Change models.py and test_models.py
- Add else condition in make_answerpaper instead of direct return
- Remove while loop in shuffle questions testcase
Diffstat (limited to 'yaksh/test_models.py')
-rw-r--r-- | yaksh/test_models.py | 20 |
1 files changed, 6 insertions, 14 deletions
diff --git a/yaksh/test_models.py b/yaksh/test_models.py index 6828b89..e3ef86e 100644 --- a/yaksh/test_models.py +++ b/yaksh/test_models.py @@ -597,7 +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 = [self.question1, self.question2, self.question3] + + que_list = Question.objects.filter(id__in=range(1, 21)) self.question_paper2.fixed_questions.add(*que_list) # Create AnswerPaper for user1 and user2 @@ -876,19 +877,10 @@ class AnswerPaperTestCases(unittest.TestCase): self.assertEqual(latest_answer.answer, "answer1") def test_shuffle_questions(self): - success = False - user1_question_set = [] - user2_question_set = [] - while not success: - ques_set_1 = list(self.user1_answerpaper.questions.all()) - ques_set_2 = list(self.user2_answerpaper.questions.all()) - if ques_set_1 == ques_set_2: - continue - else: - user1_question_set = ques_set_1 - user2_question_set = ques_set_2 - success = True - self.assertFalse(user1_question_set == user2_question_set) + 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) + self.assertFalse(ques_set_1 == ques_set_2) ############################################################################### |