diff --git a/app/templates/partials/jobs/status.html b/app/templates/partials/jobs/status.html index b6114545c..e54d0dec7 100644 --- a/app/templates/partials/jobs/status.html +++ b/app/templates/partials/jobs/status.html @@ -11,7 +11,7 @@ {% else %} Uploaded by {{ job.created_by.name }} on {{ job.created_at|format_datetime_short }} {% endif %} - {% else %} + {% else %} Sent by {{ job.created_by.name }} on {{ job.created_at|format_datetime_short }} {% if job.template.template_type == "letter" %}
@@ -20,4 +20,9 @@ {% endif %} {% endif %}
+ {% if job.status == 'sending limits exceeded'%} + + {% endif %} diff --git a/tests/app/main/views/test_jobs.py b/tests/app/main/views/test_jobs.py index 96c08b543..1892a2290 100644 --- a/tests/app/main/views/test_jobs.py +++ b/tests/app/main/views/test_jobs.py @@ -221,6 +221,26 @@ def test_should_show_job_without_notifications( assert page.select_one('tbody').text.strip() == 'No messages to show yet…' +def test_should_show_job_with_sending_limit_exceeded_status( + client_request, + service_one, + active_user_with_permissions, + mock_get_service_template, + mock_get_job_with_sending_limits_exceeded, + mock_get_notifications_with_no_notifications, + mock_get_service_data_retention, + fake_uuid, +): + page = client_request.get( + 'main.view_job', + service_id=service_one['id'], + job_id=fake_uuid, + ) + assert normalize_spaces(page.select('main p')[1].text) == ( + "You have exceeded your daily sending limits. You can upload your CSV tomorrow or contact the GOV.UK Notify team" + ) + + @freeze_time("2020-01-10 1:0:0") @pytest.mark.parametrize('created_at, processing_started, expected_message', ( # Recently created, not yet started diff --git a/tests/conftest.py b/tests/conftest.py index eeeaad4ce..33b13d10f 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -1541,6 +1541,19 @@ def mock_get_job_in_progress(mocker, api_user_active): return mocker.patch('app.job_api_client.get_job', side_effect=_get_job) +@pytest.fixture(scope='function') +def mock_get_job_with_sending_limits_exceeded(mocker, api_user_active): + def _get_job(service_id, job_id): + return {"data": job_json( + service_id, api_user_active, job_id=job_id, + notification_count=10, + notifications_requested=5, + job_status='sending limits exceeded', + )} + + return mocker.patch('app.job_api_client.get_job', side_effect=_get_job) + + @pytest.fixture(scope='function') def mock_get_letter_job_in_progress(mocker, api_user_active): def _get_job(service_id, job_id):