Make text message price dependent on date

So we don’t have to deploy a change on a Saturday.

In the future this could pull from the rates in the database, but while
that code is shifting around I didn’t want to touoch it. We’d also have
to think about caching so as not to have a non-authenticated route
hitting the database.
This commit is contained in:
Chris Hill-Scott
2022-04-28 10:48:44 +01:00
parent dfc37c2371
commit 4a0f5e8a41
5 changed files with 47 additions and 3 deletions

View File

@@ -356,3 +356,36 @@ def test_font_preload(
for element in preload_tags:
assert element['href'].startswith('https://static.example.com/fonts/')
assert element['href'].endswith('.woff2')
@pytest.mark.parametrize('current_date, expected_rate', (
('2022-04-30', '1.61'),
('2022-05-01', '1.72'),
))
def test_sms_price(
client_request,
mock_get_service_and_organisation_counts,
current_date,
expected_rate,
):
client_request.logout()
with freeze_time(current_date):
home_page = client_request.get('main.index', _test_page_title=False)
pricing_page = client_request.get('main.pricing')
assert normalize_spaces(
home_page.select('.product-page-section')[5].select('.govuk-grid-column-one-half')[1].text
) == (
f'Text messages '
f'Up to 40,000 free text messages a year, '
f'then {expected_rate} pence per message'
)
assert normalize_spaces(
pricing_page.select_one('#text-messages + p + p').text
) == (
f'When a service has used its annual allowance, it costs '
f'{expected_rate} pence (plus VAT) for each text message you '
f'send.'
)