Merge pull request #219 from alphagov/fix_delete_successful_bug

Fixed bug with deleting the 'delivered' notifications.
This commit is contained in:
NIcholas Staples
2016-04-13 12:54:38 +01:00
2 changed files with 5 additions and 3 deletions

View File

@@ -70,7 +70,7 @@ def delete_verify_codes():
def delete_successful_notifications():
try:
start = datetime.utcnow()
deleted = delete_notifications_created_more_than_a_week_ago('sending')
deleted = delete_notifications_created_more_than_a_week_ago('delivered')
current_app.logger.info(
"Delete job started {} finished {} deleted {} successful notifications".format(
start,

View File

@@ -45,14 +45,16 @@ mmg_error = {'Error': '40', 'Description': 'error'}
def test_should_call_delete_notifications_more_than_week_in_task(notify_api, mocker):
mocker.patch('app.celery.tasks.delete_notifications_created_more_than_a_week_ago')
mocked = mocker.patch('app.celery.tasks.delete_notifications_created_more_than_a_week_ago')
delete_successful_notifications()
assert mocked.assert_called_with('delivered')
assert tasks.delete_notifications_created_more_than_a_week_ago.call_count == 1
def test_should_call_delete_notifications_more_than_week_in_task(notify_api, mocker):
mocker.patch('app.celery.tasks.delete_notifications_created_more_than_a_week_ago')
mocked = mocker.patch('app.celery.tasks.delete_notifications_created_more_than_a_week_ago')
delete_failed_notifications()
mocked.assert_called_with('failed')
assert tasks.delete_notifications_created_more_than_a_week_ago.call_count == 1