mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-08-16 20:49:00 -04:00
Tell template preview whether a letter can be sent internationally
If a service has permission to send international letters then the admin app should tell template preview, so that template preview knows what rules to apply when it’s validating the address of the letter. We don’t need to wait for template preview to start looking at this query string argument – it will just ignore it for now.
This commit is contained in:
@@ -164,13 +164,21 @@ def test_from_example_template_makes_request(mocker):
|
||||
)
|
||||
|
||||
|
||||
def test_sanitise_letter_calls_template_preview_sanitise_endoint_with_file(mocker):
|
||||
@pytest.mark.parametrize('allow_international_letters, expected_url', (
|
||||
(False, 'http://localhost:9999/precompiled/sanitise?allow_international_letters=false'),
|
||||
(True, 'http://localhost:9999/precompiled/sanitise?allow_international_letters=true'),
|
||||
))
|
||||
def test_sanitise_letter_calls_template_preview_sanitise_endoint_with_file(
|
||||
mocker,
|
||||
allow_international_letters,
|
||||
expected_url,
|
||||
):
|
||||
request_mock = mocker.patch('app.template_previews.requests.post')
|
||||
|
||||
sanitise_letter('pdf_data')
|
||||
sanitise_letter('pdf_data', allow_international_letters=allow_international_letters)
|
||||
|
||||
request_mock.assert_called_once_with(
|
||||
'http://localhost:9999/precompiled/sanitise',
|
||||
expected_url,
|
||||
headers={'Authorization': 'Token my-secret-key'},
|
||||
data='pdf_data'
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user