mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-09-02 17:48:50 -04:00
Don't 'use my own number' if user doesn't have one
This commit is contained in:
@@ -410,7 +410,8 @@ def send_test_step(service_id, template_id, step_index):
|
|||||||
if (
|
if (
|
||||||
request.endpoint == 'main.send_one_off_step' and
|
request.endpoint == 'main.send_one_off_step' and
|
||||||
step_index == 0 and
|
step_index == 0 and
|
||||||
template.template_type != 'letter'
|
template.template_type != 'letter' and
|
||||||
|
not (template.template_type == 'sms' and current_user.mobile_number is None)
|
||||||
):
|
):
|
||||||
skip_link = (
|
skip_link = (
|
||||||
'Use my {}'.format(first_column_headings[template.template_type][0]),
|
'Use my {}'.format(first_column_headings[template.template_type][0]),
|
||||||
|
|||||||
@@ -660,7 +660,6 @@ def test_send_one_off_has_skip_link(
|
|||||||
expected_link_text,
|
expected_link_text,
|
||||||
expected_link_url,
|
expected_link_url,
|
||||||
):
|
):
|
||||||
|
|
||||||
template_mock(mocker)
|
template_mock(mocker)
|
||||||
mocker.patch('app.main.views.send.get_page_count_for_letter', return_value=99)
|
mocker.patch('app.main.views.send.get_page_count_for_letter', return_value=99)
|
||||||
|
|
||||||
@@ -683,6 +682,23 @@ def test_send_one_off_has_skip_link(
|
|||||||
assert not skip_links
|
assert not skip_links
|
||||||
|
|
||||||
|
|
||||||
|
def test_skip_link_will_not_show_on_sms_one_off_if_service_has_no_mobile_number(
|
||||||
|
logged_in_client,
|
||||||
|
service_one,
|
||||||
|
fake_uuid,
|
||||||
|
mock_get_service_template,
|
||||||
|
active_user_with_permissions
|
||||||
|
):
|
||||||
|
active_user_with_permissions.mobile_number = None
|
||||||
|
response = logged_in_client.get(
|
||||||
|
url_for('main.send_one_off_step', service_id=service_one['id'], template_id=fake_uuid, step_index=0),
|
||||||
|
follow_redirects=True
|
||||||
|
)
|
||||||
|
page = BeautifulSoup(response.data.decode('utf-8'), 'html.parser')
|
||||||
|
skip_links = page.select('a.top-gutter-4-3')
|
||||||
|
assert not skip_links
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.parametrize('endpoint, expected_redirect, placeholders', [
|
@pytest.mark.parametrize('endpoint, expected_redirect, placeholders', [
|
||||||
(
|
(
|
||||||
'main.send_test_step',
|
'main.send_test_step',
|
||||||
|
|||||||
Reference in New Issue
Block a user