def test_locked(self, lock_available, compute_grades_async_mock, delete_mock, add_mock): add_mock.return_value = lock_available sender = Mock() handle_grading_policy_changed(sender, course_key=unicode(self.course.id)) cache_key = 'handle_grading_policy_changed-{}'.format(unicode(self.course.id)) self.assertEqual(lock_available, compute_grades_async_mock.called) if lock_available: add_mock.assert_called_once_with(cache_key, "true", GRADING_POLICY_COUNTDOWN_SECONDS)
def test_locked(self, lock_available, compute_grades_async_mock, add_mock): add_mock.return_value = lock_available sender = Mock() handle_grading_policy_changed(sender, course_key=str(self.course.id)) cache_key = f'handle_grading_policy_changed-{str(self.course.id)}' self.assertEqual(lock_available, compute_grades_async_mock.called) if lock_available: add_mock.assert_called_once_with(cache_key, "true", GRADING_POLICY_COUNTDOWN_SECONDS)