Don’t let services go live without an organisation

We shouldn’t be making services live without an agreement in place. In
order to have an agreement in place we need to know what organisation
operates the service.

If a service comes along but belongs to an organisation we don’t know
about then we should create that organisation. This commits removes the
link, which should force this to happen.
This commit is contained in:
Chris Hill-Scott
2019-04-09 09:39:45 +01:00
parent e8b95f03c6
commit 8626777fde
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'], [