summaryrefslogtreecommitdiff
path: root/yaksh
diff options
context:
space:
mode:
Diffstat (limited to 'yaksh')
-rw-r--r--yaksh/models.py2
-rw-r--r--yaksh/test_models.py7
2 files changed, 8 insertions, 1 deletions
diff --git a/yaksh/models.py b/yaksh/models.py
index 591f0e4..56cced8 100644
--- a/yaksh/models.py
+++ b/yaksh/models.py
@@ -858,7 +858,7 @@ class QuestionPaper(models.Model):
ans_paper = AnswerPaper.objects.filter(user=user,
attempt_number=attempt_num,
question_paper=self
- ).order_by['-id']
+ ).order_by('-id')
if ans_paper:
ans_paper = ans_paper[0]
else:
diff --git a/yaksh/test_models.py b/yaksh/test_models.py
index a940c0f..bc7f114 100644
--- a/yaksh/test_models.py
+++ b/yaksh/test_models.py
@@ -451,6 +451,13 @@ class QuestionPaperTestCases(unittest.TestCase):
self.assertFalse(self.question_paper.is_prerequisite_passed(self.user))
# test can_attempt_now(self):
self.assertFalse(self.question_paper.can_attempt_now(self.user))
+ # trying to create an answerpaper with same parameters passed.
+ answerpaper2 = self.question_paper.make_answerpaper(self.user, self.ip,
+ attempt_num)
+ # check if make_answerpaper returned an object instead of creating one.
+ self.assertEqual(answerpaper, answerpaper2)
+
+
def test_create_trial_paper_to_test_quiz(self):
qu_list = [str(self.questions_list[0]), str(self.questions_list[1])]