diff --git a/app/templates/partials/notifications/notifications.html b/app/templates/partials/notifications/notifications.html index 6e2be2049..d982e2a97 100644 --- a/app/templates/partials/notifications/notifications.html +++ b/app/templates/partials/notifications/notifications.html @@ -4,14 +4,6 @@
- Download this report - - {{ time_left }} -
- {% endif %} - {% call(item, row_number) list_table( [notification], caption=None, diff --git a/app/utils.py b/app/utils.py index 309427e72..5f6afc925 100644 --- a/app/utils.py +++ b/app/utils.py @@ -155,23 +155,6 @@ def generate_notifications_csv(**kwargs): raise Exception("Should never reach here") -def generate_single_notification_csv(notification): - fieldnames = ['Recipient', 'Template', 'Type', 'Status', 'Time'] - yield ','.join(fieldnames) + '\n' - - values = [ - notification['to'], - notification['template']['name'], - notification['template']['template_type'], - notification['status'], - notification['created_at'] - ] - line = ','.join(str(i) for i in values) + '\n' - yield line - - return - - def get_page_from_request(): if 'page' in request.args: try: diff --git a/tests/app/main/views/test_notifications.py b/tests/app/main/views/test_notifications.py new file mode 100644 index 000000000..b4b70b776 --- /dev/null +++ b/tests/app/main/views/test_notifications.py @@ -0,0 +1,28 @@ +from freezegun import freeze_time +import pytest +from werkzeug.datastructures import MultiDict + +from app.main.views.notifications import get_status_arg +from app.utils import ( + REQUESTED_STATUSES, + FAILURE_STATUSES, + SENDING_STATUSES, + DELIVERED_STATUSES, +) + + +@pytest.mark.parametrize('multidict_args, expected_statuses', [ + ([], REQUESTED_STATUSES), + ([('status', '')], REQUESTED_STATUSES), + ([('status', 'garbage')], REQUESTED_STATUSES), + ([('status', 'sending')], SENDING_STATUSES), + ([('status', 'delivered')], DELIVERED_STATUSES), + ([('status', 'failed')], FAILURE_STATUSES), +]) +def test_status_filters(mocker, multidict_args, expected_statuses): + mocker.patch('app.main.views.notifications.current_app') + + args = MultiDict(multidict_args) + args['status'] = get_status_arg(args) + + assert sorted(args['status']) == sorted(expected_statuses)