Confirm no delivery estimate for emails and SMS

Only letters have a delivery estimate (which we calculate). This commit
adds a test to make sure this remains the case.
This commit is contained in:
Chris Hill-Scott
2017-09-18 11:00:21 +01:00
parent 29a962060f
commit 2e9cecd385

View File

@@ -9,6 +9,11 @@ from tests.app.db import (
create_template,
create_service)
from tests.app.conftest import (
sample_notification,
sample_email_notification,
)
@pytest.mark.parametrize('billable_units, provider', [
(1, 'mmg'),
@@ -233,6 +238,26 @@ def test_get_notification_adds_delivery_estimate_for_letters(
assert json_response['estimated_delivery'] == estimated_delivery
@pytest.mark.parametrize('notification_mock', [
sample_notification,
sample_email_notification,
])
def test_get_notification_doesnt_have_delivery_estimate_for_non_letters(
client,
notify_db,
notify_db_session,
notification_mock,
):
mocked_notification = notification_mock(notify_db, notify_db_session)
auth_header = create_authorization_header(service_id=mocked_notification.service_id)
response = client.get(
path='/v2/notifications/{}'.format(mocked_notification.id),
headers=[('Content-Type', 'application/json'), auth_header]
)
assert response.status_code == 200
assert 'estimated_delivery' not in json.loads(response.get_data(as_text=True))
def test_get_all_notifications_returns_200(client, sample_template):
notifications = [create_notification(template=sample_template) for _ in range(2)]
notification = notifications[-1]