diff options
author | Prabhu Ramachandran | 2014-06-27 19:41:15 +0530 |
---|---|---|
committer | Prabhu Ramachandran | 2014-06-27 19:41:15 +0530 |
commit | 6f27cd40d63300e3294e170daee8c058788c5fa0 (patch) | |
tree | 624b03be9921098aeffaea845b857cc357a66705 /testapp/exam/tests.py | |
parent | fa402a2c9a34a1728f863ddcbab62fa8e030099e (diff) | |
parent | 3c82dd0faf2f1273cb590b360a9696a973b30720 (diff) | |
download | online_test-6f27cd40d63300e3294e170daee8c058788c5fa0.tar.gz online_test-6f27cd40d63300e3294e170daee8c058788c5fa0.tar.bz2 online_test-6f27cd40d63300e3294e170daee8c058788c5fa0.zip |
Merge pull request #26 from prathamesh920/model_modification
Model modification
Diffstat (limited to 'testapp/exam/tests.py')
-rw-r--r-- | testapp/exam/tests.py | 25 |
1 files changed, 21 insertions, 4 deletions
diff --git a/testapp/exam/tests.py b/testapp/exam/tests.py index b2ba36f..d76e4f8 100644 --- a/testapp/exam/tests.py +++ b/testapp/exam/tests.py @@ -21,7 +21,8 @@ def setUpModule(): # create a quiz Quiz.objects.create(start_date='2014-06-16', duration=30, active=False, - description='demo quiz') + description='demo quiz', pass_criteria=40, + language='Python', prerequisite=None) def tearDownModule(): @@ -86,6 +87,9 @@ class QuizTestCases(unittest.TestCase): self.assertEqual(self.quiz.duration, 30) self.assertTrue(self.quiz.active is False) self.assertEqual(self.quiz.description, 'demo quiz') + self.assertEqual(self.quiz.language, 'Python') + self.assertEqual(self.quiz.pass_criteria, 40) + self.assertEqual(self.quiz.prerequisite, None) ############################################################################### @@ -98,7 +102,8 @@ class QuestionPaperTestCases(unittest.TestCase): # create question paper self.question_paper = QuestionPaper.objects.create(quiz=self.quiz, - total_marks=0.0) + total_marks=0.0, shuffle_questions=True) + # add fixed set of questions to the question paper self.question_paper.fixed_questions.add(self.questions[3], self.questions[5]) @@ -135,6 +140,7 @@ class QuestionPaperTestCases(unittest.TestCase): self.assertEqual(self.question_paper.quiz.description, 'demo quiz') self.assertEqual(list(self.question_paper.fixed_questions.all()), [self.questions[3], self.questions[5]]) + self.assertTrue(self.question_paper.shuffle_questions) def test_update_total_marks(self): """ Test update_total_marks() method of Question Paper""" @@ -257,9 +263,20 @@ class AnswerPaperTestCases(unittest.TestCase): answered_question = self.answerpaper.get_answered_str() self.assertEqual(answered_question, '1') - def test_get_marks_obtained(self): + def test_update_marks_obtained(self): """ Test get_marks_obtained() method of Answer Paper""" - self.assertEqual(self.answerpaper.get_marks_obtained(), 1.0) + self.answerpaper.update_marks_obtained() + self.assertEqual(self.answerpaper.marks_obtained, 1.0) + + def test_update_percent(self): + """ Test update_percent() method of Answerpaper""" + self.answerpaper.update_percent() + self.assertEqual(self.answerpaper.percent, 33.33) + + def test_update_passed(self): + """ Test update_passed method of AnswerPaper""" + self.answerpaper.update_passed() + self.assertFalse(self.answerpaper.passed) def test_get_question_answer(self): """ Test get_question_answer() method of Answer Paper""" |