summaryrefslogtreecommitdiff
path: root/yaksh
diff options
context:
space:
mode:
authormahesh2018-02-08 15:19:27 +0530
committermaheshgudi2018-03-16 15:15:50 +0530
commit337daeef8954a1be20164c5fb27050e67597b8a2 (patch)
treebb45b64a3ea0a27fed01c14f0a3f73cd07aabeb1 /yaksh
parent51c8184a795942c9f85b14a8914d03ee788e5639 (diff)
downloadonline_test-337daeef8954a1be20164c5fb27050e67597b8a2.tar.gz
online_test-337daeef8954a1be20164c5fb27050e67597b8a2.tar.bz2
online_test-337daeef8954a1be20164c5fb27050e67597b8a2.zip
Improve test cases for TestCaseOrder model
Diffstat (limited to 'yaksh')
-rw-r--r--yaksh/evaluator_tests/test_simple_question_types.py15
-rw-r--r--yaksh/models.py2
2 files changed, 15 insertions, 2 deletions
diff --git a/yaksh/evaluator_tests/test_simple_question_types.py b/yaksh/evaluator_tests/test_simple_question_types.py
index d2996e4..2d991a7 100644
--- a/yaksh/evaluator_tests/test_simple_question_types.py
+++ b/yaksh/evaluator_tests/test_simple_question_types.py
@@ -554,6 +554,15 @@ class MCQQuestionTestCases(unittest.TestCase):
attempt_num=1,
course_id=self.course.id
)
+ self.answerpaper3 = AnswerPaper.objects.create(
+ user=self.user,
+ question_paper=self.question_paper,
+ course=self.course,
+ attempt_number=self.answerpaper.attempt_number+1,
+ start_time=timezone.now(),
+ end_time=timezone.now()+timedelta(minutes=5),
+ user_ip="127.0.0.1"
+ )
@classmethod
def tearDownClass(self):
@@ -571,6 +580,10 @@ class MCQQuestionTestCases(unittest.TestCase):
self.answerpaper2
)
order2 = [tc.id for tc in user2_testcase]
-
+ not_ordered_testcase = self.question1.get_ordered_test_cases(
+ self.answerpaper3
+ )
+ get_test_cases = self.question1.get_test_cases()
# Then
self.assertNotEqual(order1, order2)
+ self.assertEqual(get_test_cases, not_ordered_testcase)
diff --git a/yaksh/models.py b/yaksh/models.py
index f823cda..0bb1e66 100644
--- a/yaksh/models.py
+++ b/yaksh/models.py
@@ -939,7 +939,7 @@ class Question(models.Model):
order = TestCaseOrder.objects.get(answer_paper=answerpaper,
question = self
).order.split(",")
- return [self.get_test_cases(id=int(tc_id))[0]\
+ return [self.get_test_case(id=int(tc_id))
for tc_id in order
]
except TestCaseOrder.DoesNotExist: