diff options
author | prathamesh | 2016-04-06 16:55:26 +0530 |
---|---|---|
committer | prathamesh | 2016-04-07 14:40:02 +0530 |
commit | b9f96f3edc315fbcab6752cf13c65dd127ab5bd1 (patch) | |
tree | 4650dadd7c00a4bd8930aff86faacbcaf0593d3d /yaksh/tests.py | |
parent | 69d53a33c77270a9244344d9de676d39502a9f1b (diff) | |
download | online_test-b9f96f3edc315fbcab6752cf13c65dd127ab5bd1.tar.gz online_test-b9f96f3edc315fbcab6752cf13c65dd127ab5bd1.tar.bz2 online_test-b9f96f3edc315fbcab6752cf13c65dd127ab5bd1.zip |
Phase 2 views cleanup
views cleaned further
used model forms
removed unwanted templates
Diffstat (limited to 'yaksh/tests.py')
-rw-r--r-- | yaksh/tests.py | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/yaksh/tests.py b/yaksh/tests.py index bdc9584..d8e108a 100644 --- a/yaksh/tests.py +++ b/yaksh/tests.py @@ -27,7 +27,7 @@ def setUpModule(): # create 20 questions for i in range(1, 21): - Question.objects.create(summary='Q%d' % (i), points=1) + Question.objects.create(summary='Q%d' % (i), points=1, type='code') # create a quiz quiz = Quiz.objects.create(start_date_time=datetime(2015, 10, 9, 10, 8, 15, 0), @@ -263,12 +263,9 @@ class QuestionPaperTestCases(unittest.TestCase): self.assertEqual(len(paper_questions), 7) fixed_questions = set(self.question_paper.fixed_questions.all()) self.assertTrue(fixed_questions.issubset(set(paper_questions))) - # test is_questionpaper_passed() answerpaper.passed = True answerpaper.save() - self.assertTrue(self.question_paper.is_questionpaper_passed(self.user)) - # test is_attempt_allowed() - self.assertFalse(self.question_paper.is_attempt_allowed(self.user)) + 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)) @@ -370,6 +367,14 @@ class AnswerPaperTestCases(unittest.TestCase): self.assertTrue(self.answerpaper.is_answer_correct(self.questions[0])) self.assertFalse(self.answerpaper.is_answer_correct(self.questions[1])) + def test_get_previous_answers(self): + answers = self.answerpaper.get_previous_answers(self.questions[0]) + self.assertEqual(answers.count(), 1) + self.assertTrue(answers[0], self.answer_right) + answers = self.answerpaper.get_previous_answers(self.questions[1]) + self.assertEqual(answers.count(), 1) + self.assertTrue(answers[0], self.answer_wrong) + ############################################################################### class CourseTestCases(unittest.TestCase): def setUp(self): |