mirror of
https://github.com/GSA/notifications-api.git
synced 2026-01-30 06:21:50 -05:00
letter estimated delivery now takes postage into account
This commit is contained in:
@@ -238,21 +238,23 @@ def test_get_notification_by_id_invalid_id(client, sample_notification, id):
|
||||
"status_code": 400}
|
||||
|
||||
|
||||
@pytest.mark.parametrize('created_at_month, estimated_delivery', [
|
||||
(
|
||||
12, '2000-12-06T16:00:00.000000Z', # 4pm GMT in winter
|
||||
),
|
||||
(
|
||||
6, '2000-06-05T15:00:00.000000Z', # 4pm BST in summer
|
||||
),
|
||||
@pytest.mark.parametrize('created_at_month, postage, estimated_delivery', [
|
||||
(12, 'second', '2000-12-06T16:00:00.000000Z'), # 4pm GMT in winter
|
||||
(6, 'second', '2000-06-05T15:00:00.000000Z'), # 4pm BST in summer
|
||||
|
||||
(12, 'first', '2000-12-05T16:00:00.000000Z'), # 4pm GMT in winter
|
||||
(6, 'first', '2000-06-03T15:00:00.000000Z'), # 4pm BST in summer (two days before 2nd class due to weekends)
|
||||
])
|
||||
def test_get_notification_adds_delivery_estimate_for_letters(
|
||||
client,
|
||||
sample_letter_notification,
|
||||
created_at_month,
|
||||
postage,
|
||||
estimated_delivery,
|
||||
):
|
||||
sample_letter_notification.created_at = datetime.date(2000, created_at_month, 1)
|
||||
sample_letter_notification.postage = postage
|
||||
|
||||
auth_header = create_authorization_header(service_id=sample_letter_notification.service_id)
|
||||
response = client.get(
|
||||
path='/v2/notifications/{}'.format(sample_letter_notification.id),
|
||||
@@ -261,20 +263,10 @@ def test_get_notification_adds_delivery_estimate_for_letters(
|
||||
|
||||
json_response = json.loads(response.get_data(as_text=True))
|
||||
assert response.status_code == 200
|
||||
assert json_response['postage'] == postage
|
||||
assert json_response['estimated_delivery'] == estimated_delivery
|
||||
|
||||
|
||||
def test_get_notification_by_id_returns_postage_class_for_letters(client, sample_letter_notification):
|
||||
auth_header = create_authorization_header(service_id=sample_letter_notification.service_id)
|
||||
response = client.get(
|
||||
path='/v2/notifications/{}'.format(sample_letter_notification.id),
|
||||
headers=[('Content-Type', 'application/json'), auth_header]
|
||||
)
|
||||
|
||||
assert response.status_code == 200
|
||||
assert response.json['postage'] == 'second'
|
||||
|
||||
|
||||
@pytest.mark.parametrize('template_type', ['sms', 'email'])
|
||||
def test_get_notification_doesnt_have_delivery_estimate_for_non_letters(client, sample_service, template_type):
|
||||
template = create_template(service=sample_service, template_type=template_type)
|
||||
|
||||
Reference in New Issue
Block a user