diff options
-rw-r--r-- | testapp/exam/models.py | 3 | ||||
-rw-r--r-- | testapp/exam/tests.py | 4 |
2 files changed, 5 insertions, 2 deletions
diff --git a/testapp/exam/models.py b/testapp/exam/models.py index 22c7913..42c5d5a 100644 --- a/testapp/exam/models.py +++ b/testapp/exam/models.py @@ -148,7 +148,8 @@ class QuestionPaper(models.Model): marks += question.points for question_set in self.random_questions.all(): marks += question_set.marks * question_set.num_questions - return marks + self.total_marks = marks + return None def _get_questions_for_answerpaper(self): """ Returns fixed and random questions for the answer paper""" diff --git a/testapp/exam/tests.py b/testapp/exam/tests.py index 2a5f1e7..b2ba36f 100644 --- a/testapp/exam/tests.py +++ b/testapp/exam/tests.py @@ -138,7 +138,9 @@ class QuestionPaperTestCases(unittest.TestCase): def test_update_total_marks(self): """ Test update_total_marks() method of Question Paper""" - self.assertEqual(self.question_paper.update_total_marks(), 15) + self.assertEqual(self.question_paper.total_marks, 0) + self.question_paper.update_total_marks() + self.assertEqual(self.question_paper.total_marks, 15) def test_get_random_questions(self): """ Test get_random_questions() method of Question Paper""" |