summaryrefslogtreecommitdiff
path: root/yaksh
diff options
context:
space:
mode:
authoradityacp2021-02-16 16:13:24 +0530
committeradityacp2021-02-16 16:13:24 +0530
commit0697dc314471a2bde90d52b1726914c85a360470 (patch)
treedc8b56154af6981894a798c6f7c209cc90b39191 /yaksh
parent1a2d31e1c59427c28211030ea09cd4964b4bd8d8 (diff)
downloadonline_test-0697dc314471a2bde90d52b1726914c85a360470.tar.gz
online_test-0697dc314471a2bde90d52b1726914c85a360470.tar.bz2
online_test-0697dc314471a2bde90d52b1726914c85a360470.zip
Change travis and tests
- Add celery run and stop worker command in travis - Fix failing tests
Diffstat (limited to 'yaksh')
-rw-r--r--yaksh/evaluator_tests/test_simple_question_types.py10
-rw-r--r--yaksh/test_models.py17
2 files changed, 10 insertions, 17 deletions
diff --git a/yaksh/evaluator_tests/test_simple_question_types.py b/yaksh/evaluator_tests/test_simple_question_types.py
index 5edd545..13d639e 100644
--- a/yaksh/evaluator_tests/test_simple_question_types.py
+++ b/yaksh/evaluator_tests/test_simple_question_types.py
@@ -662,16 +662,8 @@ class ArrangeQuestionTestCases(unittest.TestCase):
regrade_answer.answer = 1
regrade_answer.save()
details = self.answerpaper.regrade(self.question1.id)
- err_msg = dedent("""\
- User: {0}; Quiz: {1}; Question: {2}.
- {3} answer not a list.""".format(
- self.user.username,
- self.quiz.description,
- self.question1.summary,
- self.question1.type
- ))
self.assertFalse(details[0])
- self.assertEqual(details[1], err_msg)
+ self.assertIn("arrange answer not a list", details[1])
# Try regrade with incorrect answer
# When
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