Skip to content
Snippets Groups Projects
Commit e5fd4326 authored by Alex Dusenbery's avatar Alex Dusenbery Committed by Alex Dusenbery
Browse files

EDUCATOR-4307 | Don't bother with celery to run expire waiting enrollments command.

parent 12d89386
No related branches found
No related tags found
No related merge requests found
......@@ -29,5 +29,4 @@ class Command(BaseCommand):
def handle(self, *args, **options):
expiration_days = options.get('expiration_days')
logger.info(u'Deleting waiting enrollments unmodified for %s days', expiration_days)
task = tasks.expire_waiting_enrollments.apply_async(args=[expiration_days])
task.get() # wait for task to complete before exiting
tasks.expire_waiting_enrollments(expiration_days)
......@@ -19,7 +19,7 @@ class TestExpireWaitingEnrollments(TestCase):
cls.command = expire_waiting_enrollments.Command()
@ddt.data(90, None)
@patch('lms.djangoapps.program_enrollments.tasks.expire_waiting_enrollments')
@patch('lms.djangoapps.program_enrollments.tasks.expire_waiting_enrollments', autospec=True)
def test_task_fired_with_args(self, expire_days_argument, mock_task):
mock_task.return_value = {}
expected_expiration = 60
......@@ -30,10 +30,10 @@ class TestExpireWaitingEnrollments(TestCase):
else:
call_command(command)
mock_task.apply_async.assert_called_with(args=[expected_expiration])
mock_task.assert_called_with(expected_expiration)
@patch('lms.djangoapps.program_enrollments.tasks.expire_waiting_enrollments')
@patch('lms.djangoapps.program_enrollments.tasks.expire_waiting_enrollments', autospec=True)
def test_task_failure_fails_command(self, mock_task):
mock_task.apply_async.side_effect = Exception('BOOM!')
mock_task.side_effect = Exception('BOOM!')
with self.assertRaises(Exception):
call_command('expire_waiting_enrollments')
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment