mirror of
https://github.com/GSA/notifications-api.git
synced 2026-02-03 18:01:08 -05:00
Merge pull request #219 from alphagov/fix_delete_successful_bug
Fixed bug with deleting the 'delivered' notifications.
This commit is contained in:
@@ -70,7 +70,7 @@ def delete_verify_codes():
|
|||||||
def delete_successful_notifications():
|
def delete_successful_notifications():
|
||||||
try:
|
try:
|
||||||
start = datetime.utcnow()
|
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(
|
current_app.logger.info(
|
||||||
"Delete job started {} finished {} deleted {} successful notifications".format(
|
"Delete job started {} finished {} deleted {} successful notifications".format(
|
||||||
start,
|
start,
|
||||||
|
|||||||
@@ -45,14 +45,16 @@ mmg_error = {'Error': '40', 'Description': 'error'}
|
|||||||
|
|
||||||
|
|
||||||
def test_should_call_delete_notifications_more_than_week_in_task(notify_api, mocker):
|
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()
|
delete_successful_notifications()
|
||||||
|
assert mocked.assert_called_with('delivered')
|
||||||
assert tasks.delete_notifications_created_more_than_a_week_ago.call_count == 1
|
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):
|
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()
|
delete_failed_notifications()
|
||||||
|
mocked.assert_called_with('failed')
|
||||||
assert tasks.delete_notifications_created_more_than_a_week_ago.call_count == 1
|
assert tasks.delete_notifications_created_more_than_a_week_ago.call_count == 1
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user