mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-07-11 17:04:32 -04:00
Merge pull request #2821 from alphagov/dont-prefil-research-consent
Don’t prefil answer to research consent question
This commit is contained in:
@@ -151,7 +151,10 @@ def estimate_usage(service_id):
|
||||
volume_email=current_service.volume_email,
|
||||
volume_sms=current_service.volume_sms,
|
||||
volume_letter=current_service.volume_letter,
|
||||
consent_to_research='yes' if current_service.consent_to_research else 'no',
|
||||
consent_to_research={
|
||||
True: 'yes',
|
||||
False: 'no',
|
||||
}.get(current_service.consent_to_research),
|
||||
)
|
||||
|
||||
if form.validate_on_submit():
|
||||
|
||||
@@ -826,6 +826,11 @@ def test_non_gov_user_is_told_they_cant_go_live(
|
||||
assert page.select('button') == []
|
||||
|
||||
|
||||
@pytest.mark.parametrize('consent_to_research, displayed_consent', (
|
||||
(None, None),
|
||||
(True, 'yes'),
|
||||
(False, 'no'),
|
||||
))
|
||||
@pytest.mark.parametrize('volumes, displayed_volumes', (
|
||||
(
|
||||
(('email', None), ('sms', None), ('letter', None)),
|
||||
@@ -841,6 +846,8 @@ def test_should_show_estimate_volumes(
|
||||
client_request,
|
||||
volumes,
|
||||
displayed_volumes,
|
||||
consent_to_research,
|
||||
displayed_consent,
|
||||
):
|
||||
for channel, volume in volumes:
|
||||
mocker.patch(
|
||||
@@ -849,6 +856,12 @@ def test_should_show_estimate_volumes(
|
||||
new_callable=PropertyMock,
|
||||
return_value=volume,
|
||||
)
|
||||
mocker.patch(
|
||||
'app.models.service.Service.consent_to_research',
|
||||
create=True,
|
||||
new_callable=PropertyMock,
|
||||
return_value=consent_to_research,
|
||||
)
|
||||
page = client_request.get(
|
||||
'main.estimate_usage', service_id=SERVICE_ONE_ID
|
||||
)
|
||||
@@ -875,6 +888,14 @@ def test_should_show_estimate_volumes(
|
||||
) == label
|
||||
assert page.select_one('#volume_{}'.format(channel))['value'] == value
|
||||
|
||||
assert len(page.select('input[type=radio]')) == 2
|
||||
|
||||
if displayed_consent is None:
|
||||
assert len(page.select('input[checked]')) == 0
|
||||
else:
|
||||
assert len(page.select('input[checked]')) == 1
|
||||
assert page.select_one('input[checked]')['value'] == displayed_consent
|
||||
|
||||
|
||||
@pytest.mark.parametrize('consent_to_research, expected_persisted_consent_to_research', (
|
||||
('yes', True),
|
||||
|
||||
Reference in New Issue
Block a user