summaryrefslogtreecommitdiff
path: root/yaksh/test_models.py
diff options
context:
space:
mode:
authorPalaparthy Adityachandra2021-03-04 21:35:21 +0530
committerGitHub2021-03-04 21:35:21 +0530
commit85a2b6b61c74e2ed42d6c78f6b502a3c72dcf9ca (patch)
treedc8b56154af6981894a798c6f7c209cc90b39191 /yaksh/test_models.py
parentb2bf7b9fef33d59cd1e55776a51577d66a252322 (diff)
parent0697dc314471a2bde90d52b1726914c85a360470 (diff)
downloadonline_test-85a2b6b61c74e2ed42d6c78f6b502a3c72dcf9ca.tar.gz
online_test-85a2b6b61c74e2ed42d6c78f6b502a3c72dcf9ca.tar.bz2
online_test-85a2b6b61c74e2ed42d6c78f6b502a3c72dcf9ca.zip
Merge pull request #820 from adityacp/fix_upload_marks
Refactor upload marks for a quiz
Diffstat (limited to 'yaksh/test_models.py')
-rw-r--r--yaksh/test_models.py17
1 files changed, 9 insertions, 8 deletions
diff --git a/yaksh/test_models.py b/yaksh/test_models.py
index a424b36..9e0997d 100644
--- a/yaksh/test_models.py
+++ b/yaksh/test_models.py
@@ -284,8 +284,9 @@ class LearningModuleTestCases(unittest.TestCase):
self.learning_module_two = LearningModule.objects.get(name='LM2')
self.creator = User.objects.get(username='creator')
self.student = User.objects.get(username='course_user')
- self.learning_unit_one = LearningUnit.objects.get(id=1)
- self.learning_unit_two = LearningUnit.objects.get(id=2)
+ learning_units = self.learning_module.learning_unit.order_by("order")
+ self.learning_unit_one = learning_units[0]
+ self.learning_unit_two = learning_units[1]
self.quiz = Quiz.objects.get(description='demo quiz 1')
self.lesson = Lesson.objects.get(name='L1')
self.course = Course.objects.get(name='Python Course')
@@ -1420,10 +1421,10 @@ class AnswerPaperTestCases(unittest.TestCase):
expected_score = {"Q4": 1.0}
# When
score = self.answerpaper_single_question.get_per_question_score(
- [(question_name, question_id)]
+ [(question_name, question_id, f"{question_id}-comments")]
)
# Then
- self.assertEqual(score, expected_score)
+ self.assertEqual(score['Q4'], expected_score['Q4'])
# Given
question_id = self.question2.id
@@ -1431,10 +1432,10 @@ class AnswerPaperTestCases(unittest.TestCase):
expected_score = {"Q2": 0.0}
# When
score = self.answerpaper.get_per_question_score(
- [(question_name, question_id)]
+ [(question_name, question_id, f"{question_id}-comments")]
)
# Then
- self.assertEqual(score, expected_score)
+ self.assertEqual(score["Q2"], expected_score["Q2"])
# Given
question_id = 131
@@ -1442,10 +1443,10 @@ class AnswerPaperTestCases(unittest.TestCase):
expected_score = {'NA': 0}
# When
score = self.answerpaper.get_per_question_score(
- [(question_name, question_id)]
+ [(question_name, question_id, f"{question_id}-comments")]
)
# Then
- self.assertEqual(score, expected_score)
+ self.assertEqual(score["NA"], expected_score["NA"])
def test_returned_question_is_not_none(self):
# Test add_completed_question and next_question