Merge pull request #2904 from alphagov/no-live-without-organisation

Don’t let services go live without an organisation
This commit is contained in:
Chris Hill-Scott
2019-04-15 13:26:15 +01:00
committed by GitHub
2 changed files with 30 additions and 2 deletions

View File

@@ -288,8 +288,13 @@
{% call row() %}
{{ text_field('Live')}}
{{ boolean_field(not current_service.trial_mode) }}
{{ edit_field('Change', url_for('.service_switch_live', service_id=current_service.id)) }}
{% if current_service.trial_mode and not current_service.organisation %}
{{ text_field('No (you need to assign this service to an organisation before you can make it live)') }}
{{ text_field('') }}
{% else %}
{{ boolean_field(not current_service.trial_mode) }}
{{ edit_field('Change', url_for('.service_switch_live', service_id=current_service.id)) }}
{% endif %}
{% endcall %}
{% call row() %}

View File

@@ -144,6 +144,29 @@ def test_should_show_overview(
app.service_api_client.get_service.assert_called_with(service_one['id'])
def test_no_go_live_link_for_service_without_organisation(
client_request,
mocker,
no_reply_to_email_addresses,
no_letter_contact_blocks,
mock_get_service_organisation,
single_sms_sender,
platform_admin_user,
mock_get_service_settings_page_common,
):
mocker.patch('app.organisations_client.get_service_organisation', return_value=None)
client_request.login(platform_admin_user)
page = client_request.get('main.service_settings', service_id=SERVICE_ONE_ID)
assert page.find('h1').text == 'Settings'
assert normalize_spaces(page.select('tr')[16].text) == (
'Live No (you need to assign this service to an organisation before you can make it live)'
)
assert normalize_spaces(page.select('tr')[18].text) == (
'Organisation Not set Change'
)
@pytest.mark.parametrize('permissions, expected_rows', [
(['email', 'sms', 'inbound_sms', 'international_sms'], [