fix: upgrading celery version and fixing tests. (#32468)
* fix: upgrading celery version and fixing tests. --------- Co-authored-by: edX requirements bot <49161187+edx-requirements-bot@users.noreply.github.com> Co-authored-by: zubairshakoorarbisoft <zubair.shakoor@arbisoft.com> Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: awais786 <awais786@users.noreply.github.com>
This commit is contained in:
@@ -178,11 +178,11 @@ class InstructorTask(models.Model):
|
||||
too_long -= (len(traceback_string) + len('traceback'))
|
||||
else:
|
||||
# truncate the traceback:
|
||||
task_progress['traceback'] = traceback_string[:-(too_long + len(tag))] + tag
|
||||
task_progress['traceback'] = traceback_string[(too_long + len(tag)):] + tag
|
||||
too_long = 0
|
||||
if too_long > 0:
|
||||
# we need to shorten the message:
|
||||
task_progress['message'] = task_progress['message'][:-(too_long + len(tag))] + tag
|
||||
task_progress['message'] = task_progress['message'][(too_long + len(tag)):] + tag
|
||||
json_output = json.dumps(task_progress)
|
||||
return json_output
|
||||
|
||||
|
||||
@@ -62,11 +62,11 @@ class TestIntegrationTask(InstructorTaskModuleTestCase):
|
||||
assert 'student' not in task_input
|
||||
assert task_input['problem_url'] == str(InstructorTaskModuleTestCase.problem_location(problem_url_name))
|
||||
status = json.loads(instructor_task.task_output)
|
||||
assert status['exception'] == 'ZeroDivisionError'
|
||||
assert status['message'] == expected_message
|
||||
assert status['exception'] == 'ExceptionWithTraceback'
|
||||
assert expected_message in status['message']
|
||||
# check status returned:
|
||||
status = InstructorTaskModuleTestCase.get_task_status(instructor_task.task_id)
|
||||
assert status['message'] == expected_message
|
||||
assert expected_message in status['message']
|
||||
|
||||
|
||||
@ddt.ddt
|
||||
@@ -341,11 +341,12 @@ class TestRescoringTask(TestIntegrationTask):
|
||||
instructor_task = InstructorTask.objects.get(id=instructor_task.id)
|
||||
assert instructor_task.task_state == FAILURE
|
||||
status = json.loads(instructor_task.task_output)
|
||||
assert status['exception'] == 'NotImplementedError'
|
||||
assert status['message'] == "Problem's definition does not support rescoring."
|
||||
assert status['exception'] == 'ExceptionWithTraceback'
|
||||
expected_message = "Problem's definition does not support rescoring."
|
||||
assert expected_message in status['message']
|
||||
|
||||
status = InstructorTaskModuleTestCase.get_task_status(instructor_task.task_id)
|
||||
assert status['message'] == "Problem's definition does not support rescoring."
|
||||
assert expected_message in status['message']
|
||||
|
||||
def define_randomized_custom_response_problem(self, problem_url_name, redefine=False):
|
||||
"""
|
||||
|
||||
@@ -195,8 +195,8 @@ class TestInstructorTasks(InstructorTaskModuleTestCase):
|
||||
entry = InstructorTask.objects.get(id=task_entry.id)
|
||||
assert entry.task_state == FAILURE
|
||||
output = json.loads(entry.task_output)
|
||||
assert output['exception'] == 'TestTaskFailure'
|
||||
assert output['message'] == expected_message
|
||||
assert output['exception'] == 'ExceptionWithTraceback'
|
||||
assert expected_message in output['message']
|
||||
|
||||
def _test_run_with_long_error_msg(self, task_class):
|
||||
"""
|
||||
@@ -213,8 +213,10 @@ class TestInstructorTasks(InstructorTaskModuleTestCase):
|
||||
assert entry.task_state == FAILURE
|
||||
assert 1023 > len(entry.task_output)
|
||||
output = json.loads(entry.task_output)
|
||||
assert output['exception'] == 'TestTaskFailure'
|
||||
assert output['message'] == (expected_message[:(len(output['message']) - 3)] + '...')
|
||||
assert output['exception'] == 'ExceptionWithTraceback'
|
||||
assert (
|
||||
expected_message[:(len(output['message']) - 7)] + '\n"""...'
|
||||
) == output['message']
|
||||
assert 'traceback' not in output
|
||||
|
||||
def _test_run_with_short_error_msg(self, task_class):
|
||||
@@ -233,9 +235,9 @@ class TestInstructorTasks(InstructorTaskModuleTestCase):
|
||||
assert entry.task_state == FAILURE
|
||||
assert 1023 > len(entry.task_output)
|
||||
output = json.loads(entry.task_output)
|
||||
assert output['exception'] == 'TestTaskFailure'
|
||||
assert output['message'] == expected_message
|
||||
assert output['traceback'][(- 3):] == '...'
|
||||
assert output['exception'] == 'ExceptionWithTraceback'
|
||||
assert (expected_message[:(len(output['message']) - 7)] + '\n"""...') == output['message']
|
||||
assert output['message'][(- 3):] == '...'
|
||||
|
||||
|
||||
class TestOverrideScoreInstructorTask(TestInstructorTasks):
|
||||
@@ -300,9 +302,8 @@ class TestOverrideScoreInstructorTask(TestInstructorTasks):
|
||||
# check values stored in table:
|
||||
entry = InstructorTask.objects.get(id=task_entry.id)
|
||||
output = json.loads(entry.task_output)
|
||||
assert output['exception'] == 'UpdateProblemModuleStateError'
|
||||
assert output['message'] == 'Scores cannot be overridden for this problem type.'
|
||||
assert len(output['traceback']) > 0
|
||||
assert output['exception'] == 'ExceptionWithTraceback'
|
||||
assert 'Scores cannot be overridden for this problem type.' in output['message']
|
||||
|
||||
def test_overriding_unaccessable(self):
|
||||
"""
|
||||
@@ -432,12 +433,11 @@ class TestRescoreInstructorTask(TestInstructorTasks):
|
||||
# check values stored in table:
|
||||
entry = InstructorTask.objects.get(id=task_entry.id)
|
||||
output = json.loads(entry.task_output)
|
||||
assert output['exception'] == 'UpdateProblemModuleStateError'
|
||||
assert output['message'] == 'Specified module {} of type {} does not support rescoring.'.format(
|
||||
assert output['exception'] == 'ExceptionWithTraceback'
|
||||
assert 'Specified module {} of type {} does not support rescoring.'.format(
|
||||
self.location,
|
||||
mock_instance.__class__,
|
||||
)
|
||||
assert len(output['traceback']) > 0
|
||||
) in output['message']
|
||||
|
||||
def test_rescoring_unaccessable(self):
|
||||
"""
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
Tests the ``notify_credentials`` management command.
|
||||
"""
|
||||
|
||||
from datetime import datetime
|
||||
from datetime import datetime, timezone
|
||||
from unittest import mock
|
||||
|
||||
from django.core.management import call_command
|
||||
@@ -126,43 +126,43 @@ class TestNotifyCredentials(TestCase):
|
||||
@freeze_time(datetime(2017, 5, 1, 4))
|
||||
def test_auto_execution(self, mock_task):
|
||||
self.expected_options['auto'] = True
|
||||
self.expected_options['start_date'] = '2017-05-01T00:00:00'
|
||||
self.expected_options['end_date'] = '2017-05-01T04:00:00'
|
||||
self.expected_options['start_date'] = datetime(2017, 5, 1, 0, 0)
|
||||
self.expected_options['end_date'] = datetime(2017, 5, 1, 4, 0)
|
||||
|
||||
call_command(Command(), '--auto')
|
||||
assert mock_task.called
|
||||
assert mock_task.call_args[0][0] == self.expected_options
|
||||
|
||||
def test_date_args(self, mock_task):
|
||||
self.expected_options['start_date'] = '2017-01-31T00:00:00Z'
|
||||
self.expected_options['start_date'] = datetime(2017, 1, 31, 0, 0, tzinfo=timezone.utc)
|
||||
call_command(Command(), '--start-date', '2017-01-31')
|
||||
assert mock_task.called
|
||||
assert mock_task.call_args[0][0] == self.expected_options
|
||||
mock_task.reset_mock()
|
||||
|
||||
self.expected_options['start_date'] = '2017-02-01T00:00:00Z'
|
||||
self.expected_options['end_date'] = '2017-02-02T00:00:00Z'
|
||||
self.expected_options['start_date'] = datetime(2017, 2, 1, 0, 0, tzinfo=timezone.utc)
|
||||
self.expected_options['end_date'] = datetime(2017, 2, 2, 0, 0, tzinfo=timezone.utc)
|
||||
call_command(Command(), '--start-date', '2017-02-01', '--end-date', '2017-02-02')
|
||||
assert mock_task.called
|
||||
assert mock_task.call_args[0][0] == self.expected_options
|
||||
mock_task.reset_mock()
|
||||
|
||||
self.expected_options['start_date'] = None
|
||||
self.expected_options['end_date'] = '2017-02-02T00:00:00Z'
|
||||
self.expected_options['end_date'] = datetime(2017, 2, 2, 0, 0, tzinfo=timezone.utc)
|
||||
call_command(Command(), '--end-date', '2017-02-02')
|
||||
assert mock_task.called
|
||||
assert mock_task.call_args[0][0] == self.expected_options
|
||||
mock_task.reset_mock()
|
||||
|
||||
self.expected_options['start_date'] = '2017-02-01T00:00:00Z'
|
||||
self.expected_options['end_date'] = '2017-02-01T04:00:00Z'
|
||||
self.expected_options['start_date'] = datetime(2017, 2, 1, 0, 0, tzinfo=timezone.utc)
|
||||
self.expected_options['end_date'] = datetime(2017, 2, 1, 4, 0, tzinfo=timezone.utc)
|
||||
call_command(Command(), '--start-date', "2017-02-01 00:00:00", '--end-date', '2017-02-01 04:00:00')
|
||||
assert mock_task.called
|
||||
assert mock_task.call_args[0][0] == self.expected_options
|
||||
|
||||
def test_username_arg(self, mock_task):
|
||||
self.expected_options['start_date'] = '2017-02-01T00:00:00Z'
|
||||
self.expected_options['end_date'] = '2017-02-02T00:00:00Z'
|
||||
self.expected_options['start_date'] = datetime(2017, 2, 1, 0, 0, tzinfo=timezone.utc)
|
||||
self.expected_options['end_date'] = datetime(2017, 2, 2, 0, 0, tzinfo=timezone.utc)
|
||||
self.expected_options['user_ids'] = [str(self.user2.id)]
|
||||
call_command(
|
||||
'notify_credentials', '--start-date', '2017-02-01', '--end-date', '2017-02-02', '--user_ids', self.user2.id
|
||||
@@ -181,8 +181,8 @@ class TestNotifyCredentials(TestCase):
|
||||
assert mock_task.call_args[0][0] == self.expected_options
|
||||
mock_task.reset_mock()
|
||||
|
||||
self.expected_options['start_date'] = '2017-02-01T00:00:00Z'
|
||||
self.expected_options['end_date'] = '2017-02-02T00:00:00Z'
|
||||
self.expected_options['start_date'] = datetime(2017, 2, 1, 0, 0, tzinfo=timezone.utc)
|
||||
self.expected_options['end_date'] = datetime(2017, 2, 2, 0, 0, tzinfo=timezone.utc)
|
||||
self.expected_options['user_ids'] = [str(self.user.id)]
|
||||
call_command(
|
||||
'notify_credentials', '--start-date', '2017-02-01', '--end-date', '2017-02-02', '--user_ids', self.user.id
|
||||
@@ -217,28 +217,28 @@ class TestNotifyCredentials(TestCase):
|
||||
assert not mock_task.called
|
||||
|
||||
def test_dry_run(self, mock_task):
|
||||
self.expected_options['start_date'] = '2017-02-01T00:00:00Z'
|
||||
self.expected_options['start_date'] = datetime(2017, 2, 1, 0, 0, tzinfo=timezone.utc)
|
||||
self.expected_options['dry_run'] = True
|
||||
call_command(Command(), '--dry-run', '--start-date', '2017-02-01')
|
||||
assert mock_task.called
|
||||
assert mock_task.call_args[0][0] == self.expected_options
|
||||
|
||||
def test_hand_off(self, mock_task):
|
||||
self.expected_options['start_date'] = '2017-02-01T00:00:00Z'
|
||||
self.expected_options['start_date'] = datetime(2017, 2, 1, 0, 0, tzinfo=timezone.utc)
|
||||
self.expected_options['notify_programs'] = True
|
||||
call_command(Command(), '--start-date', '2017-02-01', '--notify_programs')
|
||||
assert mock_task.called
|
||||
assert mock_task.call_args[0][0] == self.expected_options
|
||||
|
||||
def test_delay(self, mock_task):
|
||||
self.expected_options['start_date'] = '2017-02-01T00:00:00Z'
|
||||
self.expected_options['start_date'] = datetime(2017, 2, 1, 0, 0, tzinfo=timezone.utc)
|
||||
self.expected_options['delay'] = 0.2
|
||||
call_command(Command(), '--start-date', '2017-02-01', '--delay', '0.2')
|
||||
assert mock_task.called
|
||||
assert mock_task.call_args[0][0] == self.expected_options
|
||||
|
||||
def test_page_size(self, mock_task):
|
||||
self.expected_options['start_date'] = '2017-02-01T00:00:00Z'
|
||||
self.expected_options['start_date'] = datetime(2017, 2, 1, 0, 0, tzinfo=timezone.utc)
|
||||
self.expected_options['page_size'] = 2
|
||||
call_command(Command(), '--start-date', '2017-02-01', '--page-size=2')
|
||||
assert mock_task.called
|
||||
@@ -249,7 +249,7 @@ class TestNotifyCredentials(TestCase):
|
||||
site_values={'course_org_filter': ['testX']}
|
||||
)
|
||||
self.expected_options['site'] = site_config.site.domain
|
||||
self.expected_options['start_date'] = '2017-01-01T00:00:00Z'
|
||||
self.expected_options['start_date'] = datetime(2017, 1, 1, 0, 0, tzinfo=timezone.utc)
|
||||
|
||||
call_command(Command(), '--site', site_config.site.domain, '--start-date', '2017-01-01')
|
||||
assert mock_task.called
|
||||
@@ -267,13 +267,13 @@ class TestNotifyCredentials(TestCase):
|
||||
config.save()
|
||||
|
||||
# Not told to use config, should ignore it
|
||||
self.expected_options['start_date'] = '2017-01-01T00:00:00Z'
|
||||
self.expected_options['start_date'] = datetime(2017, 1, 1, 0, 0, tzinfo=timezone.utc)
|
||||
call_command(Command(), '--start-date', '2017-01-01')
|
||||
assert mock_task.called
|
||||
assert mock_task.call_args[0][0] == self.expected_options
|
||||
|
||||
# Told to use it, and enabled. Should use config in preference of command line
|
||||
self.expected_options['start_date'] = '2017-03-01T00:00:00Z'
|
||||
self.expected_options['start_date'] = datetime(2017, 3, 1, 0, 0, tzinfo=timezone.utc)
|
||||
self.expected_options['skip_checks'] = False
|
||||
call_command(Command(), '--start-date', '2017-01-01', '--args-from-database')
|
||||
assert mock_task.called
|
||||
|
||||
@@ -3,7 +3,7 @@ Test credentials tasks
|
||||
"""
|
||||
|
||||
from unittest import mock
|
||||
from datetime import datetime
|
||||
from datetime import datetime, timezone
|
||||
|
||||
import ddt
|
||||
import pytest
|
||||
@@ -77,7 +77,7 @@ class TestSendGradeToCredentialTask(TestCase):
|
||||
'letter_grade': 'A',
|
||||
'percent_grade': 1.0,
|
||||
'verified': True,
|
||||
'lms_last_updated_at': last_updated.isoformat(),
|
||||
'lms_last_updated_at': last_updated,
|
||||
})
|
||||
|
||||
def test_retry(self, mock_get_api_client):
|
||||
@@ -263,15 +263,15 @@ class TestHandleNotifyCredentialsTask(TestCase):
|
||||
|
||||
@mock.patch(TASKS_MODULE + '.send_notifications')
|
||||
def test_date_args(self, mock_send):
|
||||
self.options['start_date'] = '2017-01-31T00:00:00Z'
|
||||
self.options['start_date'] = datetime(2017, 1, 31, 0, 0, tzinfo=timezone.utc)
|
||||
tasks.handle_notify_credentials(options=self.options, course_keys=[])
|
||||
assert mock_send.called
|
||||
self.assertListEqual(list(mock_send.call_args[0][0]), [self.cert2, self.cert4, self.cert3])
|
||||
self.assertListEqual(list(mock_send.call_args[0][1]), [self.grade2, self.grade4, self.grade3])
|
||||
mock_send.reset_mock()
|
||||
|
||||
self.options['start_date'] = '2017-02-01T00:00:00Z'
|
||||
self.options['end_date'] = '2017-02-02T00:00:00Z'
|
||||
self.options['start_date'] = datetime(2017, 2, 1, 0, 0, tzinfo=timezone.utc)
|
||||
self.options['end_date'] = datetime(2017, 2, 2, 0, 0, tzinfo=timezone.utc)
|
||||
tasks.handle_notify_credentials(options=self.options, course_keys=[])
|
||||
assert mock_send.called
|
||||
self.assertListEqual(list(mock_send.call_args[0][0]), [self.cert2, self.cert4])
|
||||
@@ -279,15 +279,15 @@ class TestHandleNotifyCredentialsTask(TestCase):
|
||||
mock_send.reset_mock()
|
||||
|
||||
self.options['start_date'] = None
|
||||
self.options['end_date'] = '2017-02-02T00:00:00Z'
|
||||
self.options['end_date'] = datetime(2017, 2, 2, 0, 0, tzinfo=timezone.utc)
|
||||
tasks.handle_notify_credentials(options=self.options, course_keys=[])
|
||||
assert mock_send.called
|
||||
self.assertListEqual(list(mock_send.call_args[0][0]), [self.cert1, self.cert2, self.cert4])
|
||||
self.assertListEqual(list(mock_send.call_args[0][1]), [self.grade1, self.grade2, self.grade4])
|
||||
mock_send.reset_mock()
|
||||
|
||||
self.options['start_date'] = '2017-02-01T00:00:00Z'
|
||||
self.options['end_date'] = '2017-02-01T04:00:00Z'
|
||||
self.options['start_date'] = datetime(2017, 2, 1, 0, 0, tzinfo=timezone.utc)
|
||||
self.options['end_date'] = datetime(2017, 2, 1, 4, 0, tzinfo=timezone.utc)
|
||||
tasks.handle_notify_credentials(options=self.options, course_keys=[])
|
||||
assert mock_send.called
|
||||
self.assertListEqual(list(mock_send.call_args[0][0]), [self.cert2])
|
||||
@@ -295,8 +295,8 @@ class TestHandleNotifyCredentialsTask(TestCase):
|
||||
|
||||
@mock.patch(TASKS_MODULE + '.send_notifications')
|
||||
def test_username_arg(self, mock_send):
|
||||
self.options['start_date'] = '2017-02-01T00:00:00Z'
|
||||
self.options['end_date'] = '2017-02-02T00:00:00Z'
|
||||
self.options['start_date'] = datetime(2017, 2, 1, 0, 0, tzinfo=timezone.utc)
|
||||
self.options['end_date'] = datetime(2017, 2, 2, 0, 0, tzinfo=timezone.utc)
|
||||
self.options['user_ids'] = [str(self.user2.id)]
|
||||
tasks.handle_notify_credentials(options=self.options, course_keys=[])
|
||||
assert mock_send.called
|
||||
@@ -313,8 +313,8 @@ class TestHandleNotifyCredentialsTask(TestCase):
|
||||
self.assertListEqual(list(mock_send.call_args[0][1]), [self.grade4])
|
||||
mock_send.reset_mock()
|
||||
|
||||
self.options['start_date'] = '2017-02-01T00:00:00Z'
|
||||
self.options['end_date'] = '2017-02-02T00:00:00Z'
|
||||
self.options['start_date'] = datetime(2017, 2, 1, 0, 0, tzinfo=timezone.utc)
|
||||
self.options['end_date'] = datetime(2017, 2, 2, 0, 0, tzinfo=timezone.utc)
|
||||
self.options['user_ids'] = [str(self.user.id)]
|
||||
tasks.handle_notify_credentials(options=self.options, course_keys=[])
|
||||
assert mock_send.called
|
||||
@@ -342,7 +342,7 @@ class TestHandleNotifyCredentialsTask(TestCase):
|
||||
|
||||
@mock.patch(TASKS_MODULE + '.send_notifications')
|
||||
def test_dry_run(self, mock_send):
|
||||
self.options['start_date'] = '2017-02-01T00:00:00Z'
|
||||
self.options['start_date'] = datetime(2017, 2, 1, 0, 0, tzinfo=timezone.utc)
|
||||
self.options['dry_run'] = True
|
||||
tasks.handle_notify_credentials(options=self.options, course_keys=[])
|
||||
assert not mock_send.called
|
||||
@@ -351,7 +351,7 @@ class TestHandleNotifyCredentialsTask(TestCase):
|
||||
@mock.patch(TASKS_MODULE + '.send_grade_if_interesting')
|
||||
@mock.patch(TASKS_MODULE + '.handle_course_cert_changed')
|
||||
def test_hand_off(self, mock_grade_interesting, mock_program_changed, mock_program_awarded):
|
||||
self.options['start_date'] = '2017-02-01T00:00:00Z'
|
||||
self.options['start_date'] = datetime(2017, 2, 1, 0, 0, tzinfo=timezone.utc)
|
||||
tasks.handle_notify_credentials(options=self.options, course_keys=[])
|
||||
assert mock_grade_interesting.call_count == 3
|
||||
assert mock_program_changed.call_count == 3
|
||||
@@ -360,7 +360,7 @@ class TestHandleNotifyCredentialsTask(TestCase):
|
||||
mock_program_changed.reset_mock()
|
||||
mock_program_awarded.reset_mock()
|
||||
|
||||
self.options['start_date'] = '2017-02-01T00:00:00Z'
|
||||
self.options['start_date'] = datetime(2017, 2, 1, 0, 0, tzinfo=timezone.utc)
|
||||
self.options['notify_programs'] = True
|
||||
tasks.handle_notify_credentials(options=self.options, course_keys=[])
|
||||
assert mock_grade_interesting.call_count == 3
|
||||
@@ -369,13 +369,13 @@ class TestHandleNotifyCredentialsTask(TestCase):
|
||||
|
||||
@mock.patch(TASKS_MODULE + '.time')
|
||||
def test_delay(self, mock_time):
|
||||
self.options['start_date'] = '2017-02-01T00:00:00Z'
|
||||
self.options['start_date'] = datetime(2017, 2, 1, 0, 0, tzinfo=timezone.utc)
|
||||
self.options['page_size'] = 2
|
||||
tasks.handle_notify_credentials(options=self.options, course_keys=[])
|
||||
assert mock_time.sleep.call_count == 0
|
||||
mock_time.sleep.reset_mock()
|
||||
|
||||
self.options['start_date'] = '2017-02-01T00:00:00Z'
|
||||
self.options['start_date'] = datetime(2017, 2, 1, 0, 0, tzinfo=timezone.utc)
|
||||
self.options['page_size'] = 2
|
||||
self.options['delay'] = 0.2
|
||||
tasks.handle_notify_credentials(options=self.options, course_keys=[])
|
||||
@@ -385,19 +385,19 @@ class TestHandleNotifyCredentialsTask(TestCase):
|
||||
|
||||
@override_settings(DEBUG=True)
|
||||
def test_page_size(self):
|
||||
self.options['start_date'] = '2017-01-01T00:00:00Z'
|
||||
self.options['start_date'] = datetime(2017, 1, 1, 0, 0, tzinfo=timezone.utc)
|
||||
reset_queries()
|
||||
tasks.handle_notify_credentials(options=self.options, course_keys=[])
|
||||
baseline = len(connection.queries)
|
||||
|
||||
self.options['start_date'] = '2017-01-01T00:00:00Z'
|
||||
self.options['start_date'] = datetime(2017, 1, 1, 0, 0, tzinfo=timezone.utc)
|
||||
self.options['page_size'] = 1
|
||||
reset_queries()
|
||||
tasks.handle_notify_credentials(options=self.options, course_keys=[])
|
||||
assert len(connection.queries) == (baseline + 6)
|
||||
# two extra page queries each for certs & grades
|
||||
|
||||
self.options['start_date'] = '2017-01-01T00:00:00Z'
|
||||
self.options['start_date'] = datetime(2017, 1, 1, 0, 0, tzinfo=timezone.utc)
|
||||
self.options['page_size'] = 2
|
||||
reset_queries()
|
||||
tasks.handle_notify_credentials(options=self.options, course_keys=[])
|
||||
@@ -410,21 +410,21 @@ class TestHandleNotifyCredentialsTask(TestCase):
|
||||
site_values={'course_org_filter': ['testX']}
|
||||
)
|
||||
|
||||
self.options['start_date'] = '2017-01-01T00:00:00Z'
|
||||
self.options['start_date'] = datetime(2017, 1, 1, 0, 0, tzinfo=timezone.utc)
|
||||
self.options['site'] = site_config.site.domain
|
||||
tasks.handle_notify_credentials(options=self.options, course_keys=[])
|
||||
assert mock_grade_interesting.call_count == 1
|
||||
|
||||
@mock.patch(TASKS_MODULE + '.send_notifications')
|
||||
def test_send_notifications_failure(self, mock_send):
|
||||
self.options['start_date'] = '2017-01-31T00:00:00Z'
|
||||
self.options['start_date'] = datetime(2017, 1, 31, 0, 0, tzinfo=timezone.utc)
|
||||
mock_send.side_effect = boom
|
||||
with pytest.raises(Exception):
|
||||
tasks.handle_notify_credentials(options=self.options, course_keys=[])
|
||||
|
||||
@mock.patch(TASKS_MODULE + '.send_grade_if_interesting')
|
||||
def test_send_grade_failure(self, mock_send_grade):
|
||||
self.options['start_date'] = '2017-01-31T00:00:00Z'
|
||||
self.options['start_date'] = datetime(2017, 1, 31, 0, 0, tzinfo=timezone.utc)
|
||||
mock_send_grade.side_effect = boom
|
||||
with pytest.raises(Exception):
|
||||
tasks.handle_notify_credentials(options=self.options, course_keys=[])
|
||||
|
||||
@@ -14,12 +14,7 @@
|
||||
|
||||
# As it is not clarified what exact breaking changes will be introduced as per
|
||||
# the next major release, ensure the installed version is within boundaries.
|
||||
# celery>=5.2.2,<6.0.0
|
||||
|
||||
# 5.3.0 versions breaking timezone related tests. Adding pin for time being to clear upgrade pipeline. Unpin above
|
||||
# after fixing these failures.
|
||||
celery<5.3.0
|
||||
kombu<5.3.0
|
||||
celery>=5.2.2,<6.0.0
|
||||
|
||||
|
||||
# required for celery>=5.2.0;<5.3.0
|
||||
|
||||
@@ -51,11 +51,14 @@ babel==2.11.0
|
||||
# enmerkar-underscore
|
||||
backoff==1.10.0
|
||||
# via analytics-python
|
||||
backports-zoneinfo==0.2.1
|
||||
# via icalendar
|
||||
backports-zoneinfo[tzdata]==0.2.1
|
||||
# via
|
||||
# celery
|
||||
# icalendar
|
||||
# kombu
|
||||
beautifulsoup4==4.12.2
|
||||
# via pynliner
|
||||
billiard==3.6.4.0
|
||||
billiard==4.1.0
|
||||
# via celery
|
||||
bleach[css]==6.0.0
|
||||
# via
|
||||
@@ -85,7 +88,7 @@ botocore==1.10.84
|
||||
# s3transfer
|
||||
bridgekeeper==0.9
|
||||
# via -r requirements/edx/kernel.in
|
||||
celery==5.2.7
|
||||
celery==5.3.1
|
||||
# via
|
||||
# -c requirements/edx/../constraints.txt
|
||||
# -r requirements/edx/kernel.in
|
||||
@@ -655,10 +658,8 @@ jsonschema==4.17.3
|
||||
# via optimizely-sdk
|
||||
jwcrypto==1.5.0
|
||||
# via pylti1p3
|
||||
kombu==5.2.4
|
||||
# via
|
||||
# -c requirements/edx/../constraints.txt
|
||||
# celery
|
||||
kombu==5.3.1
|
||||
# via celery
|
||||
laboratory==1.0.2
|
||||
# via -r requirements/edx/kernel.in
|
||||
lazy==1.5
|
||||
@@ -910,6 +911,7 @@ python-dateutil==2.8.2
|
||||
# -r requirements/edx/kernel.in
|
||||
# analytics-python
|
||||
# botocore
|
||||
# celery
|
||||
# edx-ace
|
||||
# edx-drf-extensions
|
||||
# edx-enterprise
|
||||
@@ -935,7 +937,6 @@ pytz==2022.7.1
|
||||
# -c requirements/edx/../constraints.txt
|
||||
# -r requirements/edx/kernel.in
|
||||
# babel
|
||||
# celery
|
||||
# django
|
||||
# django-ses
|
||||
# djangorestframework
|
||||
@@ -1123,8 +1124,13 @@ typing-extensions==4.6.3
|
||||
# via
|
||||
# asgiref
|
||||
# django-countries
|
||||
# kombu
|
||||
# pylti1p3
|
||||
# snowflake-connector-python
|
||||
tzdata==2023.3
|
||||
# via
|
||||
# backports-zoneinfo
|
||||
# celery
|
||||
unicodecsv==0.14.1
|
||||
# via
|
||||
# -r requirements/edx/kernel.in
|
||||
|
||||
@@ -82,16 +82,18 @@ backoff==1.10.0
|
||||
# via
|
||||
# -r requirements/edx/testing.txt
|
||||
# analytics-python
|
||||
backports-zoneinfo==0.2.1
|
||||
backports-zoneinfo[tzdata]==0.2.1
|
||||
# via
|
||||
# -r requirements/edx/testing.txt
|
||||
# celery
|
||||
# icalendar
|
||||
# kombu
|
||||
beautifulsoup4==4.12.2
|
||||
# via
|
||||
# -r requirements/edx/testing.txt
|
||||
# pydata-sphinx-theme
|
||||
# pynliner
|
||||
billiard==3.6.4.0
|
||||
billiard==4.1.0
|
||||
# via
|
||||
# -r requirements/edx/testing.txt
|
||||
# celery
|
||||
@@ -129,7 +131,7 @@ build==0.10.0
|
||||
# via
|
||||
# -r requirements/edx/../pip-tools.txt
|
||||
# pip-tools
|
||||
celery==5.2.7
|
||||
celery==5.3.1
|
||||
# via
|
||||
# -c requirements/edx/../constraints.txt
|
||||
# -r requirements/edx/testing.txt
|
||||
@@ -887,9 +889,8 @@ jwcrypto==1.5.0
|
||||
# via
|
||||
# -r requirements/edx/testing.txt
|
||||
# pylti1p3
|
||||
kombu==5.2.4
|
||||
kombu==5.3.1
|
||||
# via
|
||||
# -c requirements/edx/../constraints.txt
|
||||
# -r requirements/edx/testing.txt
|
||||
# celery
|
||||
laboratory==1.0.2
|
||||
@@ -1298,6 +1299,7 @@ python-dateutil==2.8.2
|
||||
# -r requirements/edx/testing.txt
|
||||
# analytics-python
|
||||
# botocore
|
||||
# celery
|
||||
# edx-ace
|
||||
# edx-drf-extensions
|
||||
# edx-enterprise
|
||||
@@ -1329,7 +1331,6 @@ pytz==2022.7.1
|
||||
# -c requirements/edx/../constraints.txt
|
||||
# -r requirements/edx/testing.txt
|
||||
# babel
|
||||
# celery
|
||||
# django
|
||||
# django-ses
|
||||
# djangorestframework
|
||||
@@ -1632,6 +1633,7 @@ typing-extensions==4.6.3
|
||||
# django-countries
|
||||
# grimp
|
||||
# import-linter
|
||||
# kombu
|
||||
# mypy
|
||||
# pydantic
|
||||
# pydata-sphinx-theme
|
||||
@@ -1639,6 +1641,11 @@ typing-extensions==4.6.3
|
||||
# pylti1p3
|
||||
# snowflake-connector-python
|
||||
# starlette
|
||||
tzdata==2023.3
|
||||
# via
|
||||
# -r requirements/edx/testing.txt
|
||||
# backports-zoneinfo
|
||||
# celery
|
||||
unicodecsv==0.14.1
|
||||
# via
|
||||
# -r requirements/edx/testing.txt
|
||||
|
||||
@@ -74,16 +74,18 @@ backoff==1.10.0
|
||||
# via
|
||||
# -r requirements/edx/base.txt
|
||||
# analytics-python
|
||||
backports-zoneinfo==0.2.1
|
||||
backports-zoneinfo[tzdata]==0.2.1
|
||||
# via
|
||||
# -r requirements/edx/base.txt
|
||||
# celery
|
||||
# icalendar
|
||||
# kombu
|
||||
beautifulsoup4==4.12.2
|
||||
# via
|
||||
# -r requirements/edx/base.txt
|
||||
# -r requirements/edx/testing.in
|
||||
# pynliner
|
||||
billiard==3.6.4.0
|
||||
billiard==4.1.0
|
||||
# via
|
||||
# -r requirements/edx/base.txt
|
||||
# celery
|
||||
@@ -117,7 +119,7 @@ botocore==1.10.84
|
||||
# s3transfer
|
||||
bridgekeeper==0.9
|
||||
# via -r requirements/edx/base.txt
|
||||
celery==5.2.7
|
||||
celery==5.3.1
|
||||
# via
|
||||
# -c requirements/edx/../constraints.txt
|
||||
# -r requirements/edx/base.txt
|
||||
@@ -841,9 +843,8 @@ jwcrypto==1.5.0
|
||||
# via
|
||||
# -r requirements/edx/base.txt
|
||||
# pylti1p3
|
||||
kombu==5.2.4
|
||||
kombu==5.3.1
|
||||
# via
|
||||
# -c requirements/edx/../constraints.txt
|
||||
# -r requirements/edx/base.txt
|
||||
# celery
|
||||
laboratory==1.0.2
|
||||
@@ -1216,6 +1217,7 @@ python-dateutil==2.8.2
|
||||
# -r requirements/edx/base.txt
|
||||
# analytics-python
|
||||
# botocore
|
||||
# celery
|
||||
# edx-ace
|
||||
# edx-drf-extensions
|
||||
# edx-enterprise
|
||||
@@ -1247,7 +1249,6 @@ pytz==2022.7.1
|
||||
# -c requirements/edx/../constraints.txt
|
||||
# -r requirements/edx/base.txt
|
||||
# babel
|
||||
# celery
|
||||
# django
|
||||
# django-ses
|
||||
# djangorestframework
|
||||
@@ -1503,11 +1504,17 @@ typing-extensions==4.6.3
|
||||
# django-countries
|
||||
# grimp
|
||||
# import-linter
|
||||
# kombu
|
||||
# pydantic
|
||||
# pylint
|
||||
# pylti1p3
|
||||
# snowflake-connector-python
|
||||
# starlette
|
||||
tzdata==2023.3
|
||||
# via
|
||||
# -r requirements/edx/base.txt
|
||||
# backports-zoneinfo
|
||||
# celery
|
||||
unicodecsv==0.14.1
|
||||
# via
|
||||
# -r requirements/edx/base.txt
|
||||
|
||||
Reference in New Issue
Block a user