mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-08-24 00:07:02 -04:00
Merge pull request #3613 from alphagov/show-international-immediately
Show international postage as soon as address is entered
This commit is contained in:
@@ -24,7 +24,7 @@ Shapely==1.7.1
|
|||||||
awscli-cwlogs>=1.4,<1.5
|
awscli-cwlogs>=1.4,<1.5
|
||||||
itsdangerous==1.1.0
|
itsdangerous==1.1.0
|
||||||
|
|
||||||
git+https://github.com/alphagov/notifications-utils.git@41.2.0#egg=notifications-utils==41.2.0
|
git+https://github.com/alphagov/notifications-utils.git@41.3.0#egg=notifications-utils==41.3.0
|
||||||
git+https://github.com/alphagov/govuk-frontend-jinja.git@v0.5.1-alpha#egg=govuk-frontend-jinja==0.5.1-alpha
|
git+https://github.com/alphagov/govuk-frontend-jinja.git@v0.5.1-alpha#egg=govuk-frontend-jinja==0.5.1-alpha
|
||||||
|
|
||||||
# gds-metrics requires prometheseus 0.2.0, override that requirement as later versions bring significant performance gains
|
# gds-metrics requires prometheseus 0.2.0, override that requirement as later versions bring significant performance gains
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ Shapely==1.7.1
|
|||||||
awscli-cwlogs>=1.4,<1.5
|
awscli-cwlogs>=1.4,<1.5
|
||||||
itsdangerous==1.1.0
|
itsdangerous==1.1.0
|
||||||
|
|
||||||
git+https://github.com/alphagov/notifications-utils.git@41.2.0#egg=notifications-utils==41.2.0
|
git+https://github.com/alphagov/notifications-utils.git@41.3.0#egg=notifications-utils==41.3.0
|
||||||
git+https://github.com/alphagov/govuk-frontend-jinja.git@v0.5.1-alpha#egg=govuk-frontend-jinja==0.5.1-alpha
|
git+https://github.com/alphagov/govuk-frontend-jinja.git@v0.5.1-alpha#egg=govuk-frontend-jinja==0.5.1-alpha
|
||||||
|
|
||||||
# gds-metrics requires prometheseus 0.2.0, override that requirement as later versions bring significant performance gains
|
# gds-metrics requires prometheseus 0.2.0, override that requirement as later versions bring significant performance gains
|
||||||
@@ -34,10 +34,10 @@ prometheus-client==0.8.0
|
|||||||
gds-metrics==0.2.4
|
gds-metrics==0.2.4
|
||||||
|
|
||||||
## The following requirements were added by pip freeze:
|
## The following requirements were added by pip freeze:
|
||||||
awscli==1.18.133
|
awscli==1.18.134
|
||||||
bleach==3.1.4
|
bleach==3.1.4
|
||||||
boto3==1.10.38
|
boto3==1.10.38
|
||||||
botocore==1.17.56
|
botocore==1.17.57
|
||||||
cachetools==4.1.0
|
cachetools==4.1.0
|
||||||
certifi==2020.6.20
|
certifi==2020.6.20
|
||||||
chardet==3.0.4
|
chardet==3.0.4
|
||||||
|
|||||||
@@ -702,6 +702,47 @@ def test_upload_csv_file_with_international_letters_permission_shows_appropriate
|
|||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.mark.parametrize('row_index, expected_postage', (
|
||||||
|
(2, 'Postage: second class'),
|
||||||
|
(3, 'Postage: international'),
|
||||||
|
))
|
||||||
|
def test_upload_csv_file_with_international_letters_permission_shows_correct_postage(
|
||||||
|
client_request,
|
||||||
|
service_one,
|
||||||
|
mocker,
|
||||||
|
mock_get_service_letter_template,
|
||||||
|
mock_s3_upload,
|
||||||
|
mock_get_users_by_service,
|
||||||
|
mock_get_service_statistics,
|
||||||
|
mock_get_job_doesnt_exist,
|
||||||
|
mock_get_jobs,
|
||||||
|
fake_uuid,
|
||||||
|
row_index,
|
||||||
|
expected_postage,
|
||||||
|
):
|
||||||
|
service_one['permissions'] += ['letter', 'international_letters']
|
||||||
|
mocker.patch('app.main.views.send.get_page_count_for_letter', return_value=9)
|
||||||
|
mocker.patch(
|
||||||
|
'app.main.views.send.s3download',
|
||||||
|
return_value='''
|
||||||
|
address line 1, address line 3, address line 6,
|
||||||
|
Firstname Lastname, 123 Example St., SW1A 1AA
|
||||||
|
Firstname Lastname, 123 Example St., France
|
||||||
|
'''
|
||||||
|
)
|
||||||
|
|
||||||
|
page = client_request.get(
|
||||||
|
'main.check_messages',
|
||||||
|
service_id=SERVICE_ONE_ID,
|
||||||
|
template_id=fake_uuid,
|
||||||
|
upload_id=fake_uuid,
|
||||||
|
row_index=row_index,
|
||||||
|
_test_page_title=False,
|
||||||
|
)
|
||||||
|
|
||||||
|
assert normalize_spaces(page.select_one('.letter-postage').text) == expected_postage
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.parametrize('file_contents, expected_error,', [
|
@pytest.mark.parametrize('file_contents, expected_error,', [
|
||||||
(
|
(
|
||||||
"""
|
"""
|
||||||
@@ -2282,6 +2323,43 @@ def test_send_one_off_letter_copes_with_placeholder_from_address_block(
|
|||||||
assert normalize_spaces(previous_page.select_one('form label').text) == 'Address'
|
assert normalize_spaces(previous_page.select_one('form label').text) == 'Address'
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.mark.parametrize('last_line, expected_postage', (
|
||||||
|
('France', 'Postage: international'),
|
||||||
|
('SW1A 1AA', 'Postage: second class'),
|
||||||
|
))
|
||||||
|
def test_send_one_off_letter_shows_international_postage(
|
||||||
|
client_request,
|
||||||
|
service_one,
|
||||||
|
mocker,
|
||||||
|
fake_uuid,
|
||||||
|
mock_get_service_letter_template_with_placeholders,
|
||||||
|
mock_template_preview,
|
||||||
|
no_letter_contact_blocks,
|
||||||
|
last_line,
|
||||||
|
expected_postage,
|
||||||
|
):
|
||||||
|
service_one['permissions'] += ['letter', 'international_letters']
|
||||||
|
|
||||||
|
with client_request.session_transaction() as session:
|
||||||
|
session['recipient'] = None
|
||||||
|
session['placeholders'] = {}
|
||||||
|
|
||||||
|
page = client_request.post(
|
||||||
|
'main.send_one_off_letter_address',
|
||||||
|
service_id=SERVICE_ONE_ID,
|
||||||
|
template_id=fake_uuid,
|
||||||
|
_data={'address': f'''
|
||||||
|
123 Example Street
|
||||||
|
Paris
|
||||||
|
{last_line}
|
||||||
|
'''},
|
||||||
|
_follow_redirects=True,
|
||||||
|
)
|
||||||
|
|
||||||
|
assert normalize_spaces(page.select_one('form label').text) == 'name'
|
||||||
|
assert normalize_spaces(page.select_one('.letter-postage').text) == expected_postage
|
||||||
|
|
||||||
|
|
||||||
def test_send_test_sms_message_puts_submitted_data_in_session(
|
def test_send_test_sms_message_puts_submitted_data_in_session(
|
||||||
client_request,
|
client_request,
|
||||||
service_one,
|
service_one,
|
||||||
|
|||||||
Reference in New Issue
Block a user