summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--yaksh/test_models.py9
-rw-r--r--yaksh/test_views.py6
2 files changed, 7 insertions, 8 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)
diff --git a/yaksh/test_views.py b/yaksh/test_views.py
index 2d86b77..dc06126 100644
--- a/yaksh/test_views.py
+++ b/yaksh/test_views.py
@@ -2092,13 +2092,13 @@ class TestViewAnswerPaper(TestCase):
self.quiz = Quiz.objects.create(time_between_attempts=0, course=self.course,
description='demo quiz', language='Python')
-
+ self.user3 = User.objects.get(username="demo_user3")
self.question_paper = QuestionPaper.objects.create(quiz=self.quiz,
total_marks=1.0)
self.question_paper.fixed_questions.add(self.question)
self.question_paper.save()
- self.ans_paper = AnswerPaper.objects.create(user_id=3,
+ self.ans_paper = AnswerPaper.objects.create(user=self.user3,
attempt_number=1, question_paper=self.question_paper,
start_time=timezone.now(), user_ip='101.0.0.1',
end_time=timezone.now()+timezone.timedelta(minutes=20))
@@ -2382,7 +2382,7 @@ class TestGrader(TestCase):
self.question_paper.fixed_questions.add(self.question)
self.question_paper.save()
- self.answerpaper = AnswerPaper.objects.create(user_id=3,
+ self.answerpaper = AnswerPaper.objects.create(user=self.user2,
attempt_number=1, question_paper=self.question_paper,
start_time=timezone.now(), user_ip='101.0.0.1',
end_time=timezone.now()+timezone.timedelta(minutes=20))