2017-10-05 10:46:55 +01:00
|
|
|
|
import pytest
|
2018-02-20 11:22:17 +00:00
|
|
|
|
from flask import session, url_for
|
2021-03-05 15:03:23 +00:00
|
|
|
|
from freezegun import freeze_time
|
2021-02-15 11:41:26 +00:00
|
|
|
|
from notifications_python_client.errors import HTTPError
|
2017-08-07 11:30:25 +01:00
|
|
|
|
|
2016-10-28 10:48:29 +01:00
|
|
|
|
from app.utils import is_gov_user
|
2019-05-03 13:35:52 +01:00
|
|
|
|
from tests import organisation_json
|
2019-12-20 15:02:47 +00:00
|
|
|
|
from tests.conftest import normalize_spaces
|
2016-03-31 15:17:05 +01:00
|
|
|
|
|
2015-12-14 17:12:28 +00:00
|
|
|
|
|
2017-02-03 10:42:01 +00:00
|
|
|
|
def test_non_gov_user_cannot_see_add_service_button(
|
|
|
|
|
|
client,
|
|
|
|
|
|
mock_login,
|
|
|
|
|
|
mock_get_non_govuser,
|
|
|
|
|
|
api_nongov_user_active,
|
2019-05-28 16:11:54 +01:00
|
|
|
|
mock_get_organisations,
|
|
|
|
|
|
mock_get_organisations_and_services_for_user,
|
2017-02-03 10:42:01 +00:00
|
|
|
|
):
|
2016-10-30 09:20:53 +00:00
|
|
|
|
client.login(api_nongov_user_active)
|
2018-03-08 16:51:53 +00:00
|
|
|
|
response = client.get(url_for('main.choose_account'))
|
2016-10-30 09:20:53 +00:00
|
|
|
|
assert 'Add a new service' not in response.get_data(as_text=True)
|
|
|
|
|
|
assert response.status_code == 200
|
|
|
|
|
|
|
|
|
|
|
|
|
2019-05-03 13:35:52 +01:00
|
|
|
|
@pytest.mark.parametrize('org_json', (
|
|
|
|
|
|
None,
|
|
|
|
|
|
organisation_json(organisation_type=None),
|
|
|
|
|
|
))
|
2017-02-03 10:42:01 +00:00
|
|
|
|
def test_get_should_render_add_service_template(
|
2019-04-18 12:44:18 +01:00
|
|
|
|
client_request,
|
2019-05-03 13:35:52 +01:00
|
|
|
|
mocker,
|
|
|
|
|
|
org_json,
|
2017-02-03 10:42:01 +00:00
|
|
|
|
):
|
2019-05-03 13:35:52 +01:00
|
|
|
|
mocker.patch(
|
|
|
|
|
|
'app.organisations_client.get_organisation_by_domain',
|
|
|
|
|
|
return_value=org_json,
|
|
|
|
|
|
)
|
2019-03-26 12:35:32 +00:00
|
|
|
|
page = client_request.get('main.add_service')
|
2019-04-18 12:44:18 +01:00
|
|
|
|
assert page.select_one('h1').text.strip() == 'About your service'
|
2020-08-07 12:18:29 +01:00
|
|
|
|
assert page.select_one('input[name=name]').get('value') is None
|
2019-04-18 12:44:18 +01:00
|
|
|
|
assert [
|
2020-06-26 20:39:20 +01:00
|
|
|
|
label.text.strip() for label in page.select('.govuk-radios__item label')
|
2019-04-18 12:44:18 +01:00
|
|
|
|
] == [
|
|
|
|
|
|
'Central government',
|
|
|
|
|
|
'Local government',
|
2019-07-15 18:03:59 +01:00
|
|
|
|
'NHS – central government agency or public body',
|
2019-07-16 15:37:27 +01:00
|
|
|
|
'NHS Trust or Clinical Commissioning Group',
|
|
|
|
|
|
'GP practice',
|
2019-07-15 18:03:59 +01:00
|
|
|
|
'Emergency service',
|
|
|
|
|
|
'School or college',
|
|
|
|
|
|
'Other',
|
2019-04-18 12:44:18 +01:00
|
|
|
|
]
|
|
|
|
|
|
assert [
|
2020-06-26 20:39:20 +01:00
|
|
|
|
radio['value'] for radio in page.select('.govuk-radios__item input')
|
2019-04-18 12:44:18 +01:00
|
|
|
|
] == [
|
|
|
|
|
|
'central',
|
|
|
|
|
|
'local',
|
2019-07-15 18:03:59 +01:00
|
|
|
|
'nhs_central',
|
|
|
|
|
|
'nhs_local',
|
2019-08-27 16:26:50 +01:00
|
|
|
|
'nhs_gp',
|
2019-07-15 18:03:59 +01:00
|
|
|
|
'emergency_service',
|
|
|
|
|
|
'school_or_college',
|
|
|
|
|
|
'other',
|
2019-04-18 12:44:18 +01:00
|
|
|
|
]
|
2015-12-14 17:12:28 +00:00
|
|
|
|
|
|
|
|
|
|
|
2019-04-18 12:44:18 +01:00
|
|
|
|
def test_get_should_not_render_radios_if_org_type_known(
|
|
|
|
|
|
client_request,
|
|
|
|
|
|
mocker,
|
|
|
|
|
|
):
|
2019-12-20 15:02:47 +00:00
|
|
|
|
mocker.patch(
|
|
|
|
|
|
'app.organisations_client.get_organisation_by_domain',
|
|
|
|
|
|
return_value=organisation_json(organisation_type='central'),
|
|
|
|
|
|
)
|
2019-04-18 12:44:18 +01:00
|
|
|
|
page = client_request.get('main.add_service')
|
|
|
|
|
|
assert page.select_one('h1').text.strip() == 'About your service'
|
2020-08-07 12:18:29 +01:00
|
|
|
|
assert page.select_one('input[name=name]').get('value') is None
|
2019-04-18 12:44:18 +01:00
|
|
|
|
assert not page.select('.multiple-choice')
|
|
|
|
|
|
|
|
|
|
|
|
|
2020-07-01 11:18:20 +01:00
|
|
|
|
def test_show_different_page_if_user_org_type_is_local(
|
|
|
|
|
|
client_request,
|
|
|
|
|
|
mocker,
|
|
|
|
|
|
):
|
|
|
|
|
|
mocker.patch(
|
|
|
|
|
|
'app.organisations_client.get_organisation_by_domain',
|
|
|
|
|
|
return_value=organisation_json(organisation_type='local'),
|
|
|
|
|
|
)
|
|
|
|
|
|
page = client_request.get('main.add_service')
|
|
|
|
|
|
assert page.select_one('h1').text.strip() == 'About your service'
|
2020-08-07 12:18:29 +01:00
|
|
|
|
assert page.select_one('input[name=name]').get('value') is None
|
2020-07-01 11:18:20 +01:00
|
|
|
|
assert page.select_one('main .govuk-body').text.strip() == (
|
2020-07-01 11:49:11 +01:00
|
|
|
|
'Give your service a name that tells users what your '
|
2020-07-01 11:18:20 +01:00
|
|
|
|
'messages are about, as well as who they’re from. For example:')
|
|
|
|
|
|
|
|
|
|
|
|
|
2019-05-07 10:31:16 +01:00
|
|
|
|
@pytest.mark.parametrize('email_address', (
|
|
|
|
|
|
# User’s email address doesn’t matter when the organisation is known
|
|
|
|
|
|
'test@example.gov.uk',
|
|
|
|
|
|
'test@example.nhs.uk',
|
|
|
|
|
|
))
|
2019-04-18 12:44:18 +01:00
|
|
|
|
@pytest.mark.parametrize('inherited, posted, persisted, sms_limit', (
|
2021-03-10 14:56:51 +00:00
|
|
|
|
(None, 'central', 'central', 150_000),
|
|
|
|
|
|
(None, 'nhs_central', 'nhs_central', 150_000),
|
|
|
|
|
|
(None, 'nhs_gp', 'nhs_gp', 10_000),
|
|
|
|
|
|
(None, 'nhs_local', 'nhs_local', 25_000),
|
|
|
|
|
|
(None, 'local', 'local', 25_000),
|
|
|
|
|
|
(None, 'emergency_service', 'emergency_service', 25_000),
|
|
|
|
|
|
(None, 'school_or_college', 'school_or_college', 10_000),
|
|
|
|
|
|
(None, 'other', 'other', 10_000),
|
|
|
|
|
|
('central', None, 'central', 150_000),
|
|
|
|
|
|
('nhs_central', None, 'nhs_central', 150_000),
|
|
|
|
|
|
('nhs_local', None, 'nhs_local', 25_000),
|
|
|
|
|
|
('local', None, 'local', 25_000),
|
|
|
|
|
|
('emergency_service', None, 'emergency_service', 25_000),
|
|
|
|
|
|
('school_or_college', None, 'school_or_college', 10_000),
|
|
|
|
|
|
('other', None, 'other', 10_000),
|
|
|
|
|
|
('central', 'local', 'central', 150_000),
|
2019-04-18 12:44:18 +01:00
|
|
|
|
))
|
2021-03-05 15:03:23 +00:00
|
|
|
|
@freeze_time("2021-01-01")
|
2017-02-03 10:42:01 +00:00
|
|
|
|
def test_should_add_service_and_redirect_to_tour_when_no_services(
|
2019-04-18 12:44:18 +01:00
|
|
|
|
mocker,
|
2019-03-26 12:35:32 +00:00
|
|
|
|
client_request,
|
2017-02-03 10:42:01 +00:00
|
|
|
|
mock_create_service,
|
|
|
|
|
|
mock_create_service_template,
|
|
|
|
|
|
mock_get_services_with_no_services,
|
|
|
|
|
|
api_user_active,
|
2018-09-03 11:46:41 +01:00
|
|
|
|
mock_get_all_email_branding,
|
2019-04-18 12:44:18 +01:00
|
|
|
|
inherited,
|
2019-05-07 10:31:16 +01:00
|
|
|
|
email_address,
|
2019-04-18 12:44:18 +01:00
|
|
|
|
posted,
|
|
|
|
|
|
persisted,
|
|
|
|
|
|
sms_limit,
|
2017-02-03 10:42:01 +00:00
|
|
|
|
):
|
2019-05-23 15:27:35 +01:00
|
|
|
|
api_user_active['email_address'] = email_address
|
2019-05-07 10:31:16 +01:00
|
|
|
|
client_request.login(api_user_active)
|
2019-12-20 15:02:47 +00:00
|
|
|
|
mocker.patch(
|
|
|
|
|
|
'app.organisations_client.get_organisation_by_domain',
|
|
|
|
|
|
return_value=organisation_json(organisation_type=inherited),
|
|
|
|
|
|
)
|
2019-03-26 12:35:32 +00:00
|
|
|
|
client_request.post(
|
|
|
|
|
|
'main.add_service',
|
|
|
|
|
|
_data={
|
2017-10-04 11:49:32 +01:00
|
|
|
|
'name': 'testing the post',
|
2019-04-18 12:44:18 +01:00
|
|
|
|
'organisation_type': posted,
|
2019-03-26 12:35:32 +00:00
|
|
|
|
},
|
|
|
|
|
|
_expected_status=302,
|
|
|
|
|
|
_expected_redirect=url_for(
|
2020-09-30 14:23:15 +01:00
|
|
|
|
'main.begin_tour',
|
2019-03-26 12:35:32 +00:00
|
|
|
|
service_id=101,
|
|
|
|
|
|
template_id="Example%20text%20message%20template",
|
|
|
|
|
|
_external=True,
|
|
|
|
|
|
),
|
2017-10-04 11:49:32 +01:00
|
|
|
|
)
|
2017-02-03 12:07:21 +00:00
|
|
|
|
assert mock_get_services_with_no_services.called
|
|
|
|
|
|
mock_create_service.assert_called_once_with(
|
2018-04-19 14:01:45 +01:00
|
|
|
|
service_name='testing the post',
|
2019-04-18 12:44:18 +01:00
|
|
|
|
organisation_type=persisted,
|
|
|
|
|
|
message_limit=50,
|
2018-04-19 14:01:45 +01:00
|
|
|
|
restricted=True,
|
2019-05-23 15:27:35 +01:00
|
|
|
|
user_id=api_user_active['id'],
|
2019-02-12 14:02:21 +00:00
|
|
|
|
email_from='testing.the.post',
|
2017-02-03 12:07:21 +00:00
|
|
|
|
)
|
2017-03-09 10:30:19 +00:00
|
|
|
|
mock_create_service_template.assert_called_once_with(
|
|
|
|
|
|
'Example text message template',
|
|
|
|
|
|
'sms',
|
|
|
|
|
|
(
|
|
|
|
|
|
'Hey ((name)), I’m trying out Notify. Today is '
|
|
|
|
|
|
'((day of week)) and my favourite colour is ((colour)).'
|
|
|
|
|
|
),
|
|
|
|
|
|
101,
|
|
|
|
|
|
)
|
2017-02-03 12:07:21 +00:00
|
|
|
|
assert session['service_id'] == 101
|
2016-04-28 16:44:12 +01:00
|
|
|
|
|
|
|
|
|
|
|
2019-05-15 16:16:23 +01:00
|
|
|
|
def test_add_service_has_to_choose_org_type(
|
|
|
|
|
|
mocker,
|
|
|
|
|
|
client_request,
|
|
|
|
|
|
mock_create_service,
|
|
|
|
|
|
mock_create_service_template,
|
|
|
|
|
|
mock_get_services_with_no_services,
|
|
|
|
|
|
api_user_active,
|
|
|
|
|
|
mock_get_all_email_branding,
|
|
|
|
|
|
):
|
|
|
|
|
|
mocker.patch(
|
|
|
|
|
|
'app.organisations_client.get_organisation_by_domain',
|
|
|
|
|
|
return_value=None,
|
|
|
|
|
|
)
|
|
|
|
|
|
page = client_request.post(
|
|
|
|
|
|
'main.add_service',
|
|
|
|
|
|
_data={
|
|
|
|
|
|
'name': 'testing the post',
|
|
|
|
|
|
},
|
|
|
|
|
|
_expected_status=200,
|
|
|
|
|
|
)
|
2020-06-26 20:39:20 +01:00
|
|
|
|
assert normalize_spaces(page.select_one('.govuk-error-message').text) == (
|
|
|
|
|
|
'Error: Select the type of organisation'
|
2019-05-15 16:16:23 +01:00
|
|
|
|
)
|
|
|
|
|
|
assert mock_create_service.called is False
|
|
|
|
|
|
assert mock_create_service_template.called is False
|
|
|
|
|
|
|
|
|
|
|
|
|
2019-05-07 10:31:16 +01:00
|
|
|
|
@pytest.mark.parametrize('email_address', (
|
|
|
|
|
|
'test@nhs.net',
|
|
|
|
|
|
'test@nhs.uk',
|
|
|
|
|
|
'test@example.NhS.uK',
|
|
|
|
|
|
'test@EXAMPLE.NHS.NET',
|
|
|
|
|
|
))
|
2019-07-16 15:37:27 +01:00
|
|
|
|
def test_get_should_only_show_nhs_org_types_radios_if_user_has_nhs_email(
|
2019-05-07 10:31:16 +01:00
|
|
|
|
client_request,
|
2019-07-16 15:37:27 +01:00
|
|
|
|
mocker,
|
2019-05-07 10:31:16 +01:00
|
|
|
|
api_user_active,
|
|
|
|
|
|
email_address,
|
|
|
|
|
|
):
|
2019-05-23 15:27:35 +01:00
|
|
|
|
api_user_active['email_address'] = email_address
|
2019-05-07 10:31:16 +01:00
|
|
|
|
client_request.login(api_user_active)
|
|
|
|
|
|
mocker.patch(
|
|
|
|
|
|
'app.organisations_client.get_organisation_by_domain',
|
|
|
|
|
|
return_value=None,
|
|
|
|
|
|
)
|
2019-07-16 15:37:27 +01:00
|
|
|
|
page = client_request.get('main.add_service')
|
|
|
|
|
|
assert page.select_one('h1').text.strip() == 'About your service'
|
2020-08-07 12:18:29 +01:00
|
|
|
|
assert page.select_one('input[name=name]').get('value') is None
|
2019-07-16 15:37:27 +01:00
|
|
|
|
assert [
|
2020-06-26 20:39:20 +01:00
|
|
|
|
label.text.strip() for label in page.select('.govuk-radios__item label')
|
2019-07-16 15:37:27 +01:00
|
|
|
|
] == [
|
|
|
|
|
|
'NHS – central government agency or public body',
|
|
|
|
|
|
'NHS Trust or Clinical Commissioning Group',
|
|
|
|
|
|
'GP practice',
|
|
|
|
|
|
]
|
|
|
|
|
|
assert [
|
2020-06-26 20:39:20 +01:00
|
|
|
|
radio['value'] for radio in page.select('.govuk-radios__item input')
|
2019-07-16 15:37:27 +01:00
|
|
|
|
] == [
|
|
|
|
|
|
'nhs_central',
|
|
|
|
|
|
'nhs_local',
|
2019-08-27 16:26:50 +01:00
|
|
|
|
'nhs_gp',
|
2019-07-16 15:37:27 +01:00
|
|
|
|
]
|
2019-05-07 10:31:16 +01:00
|
|
|
|
|
|
|
|
|
|
|
2021-03-10 14:51:40 +00:00
|
|
|
|
@pytest.mark.parametrize('organisation_type, free_allowance', [
|
|
|
|
|
|
('central', 150_000),
|
|
|
|
|
|
('local', 25_000),
|
|
|
|
|
|
('nhs_central', 150_000),
|
|
|
|
|
|
('nhs_local', 25_000),
|
|
|
|
|
|
('nhs_gp', 10_000),
|
|
|
|
|
|
('school_or_college', 10_000),
|
|
|
|
|
|
('emergency_service', 25_000),
|
|
|
|
|
|
('other', 10_000),
|
2017-10-05 10:46:55 +01:00
|
|
|
|
])
|
2017-02-03 10:42:01 +00:00
|
|
|
|
def test_should_add_service_and_redirect_to_dashboard_when_existing_service(
|
|
|
|
|
|
app_,
|
2020-03-20 08:42:33 +00:00
|
|
|
|
mocker,
|
2019-03-26 12:35:32 +00:00
|
|
|
|
client_request,
|
2017-02-03 10:42:01 +00:00
|
|
|
|
mock_create_service,
|
|
|
|
|
|
mock_create_service_template,
|
|
|
|
|
|
mock_get_services,
|
2020-03-20 08:42:33 +00:00
|
|
|
|
mock_get_no_organisation_by_domain,
|
2017-02-03 10:42:01 +00:00
|
|
|
|
api_user_active,
|
2017-10-05 10:46:55 +01:00
|
|
|
|
organisation_type,
|
|
|
|
|
|
free_allowance,
|
2018-09-03 11:46:41 +01:00
|
|
|
|
mock_get_all_email_branding,
|
2017-02-03 10:42:01 +00:00
|
|
|
|
):
|
2019-03-26 12:35:32 +00:00
|
|
|
|
client_request.post(
|
|
|
|
|
|
'main.add_service',
|
|
|
|
|
|
_data={
|
2017-10-04 11:49:32 +01:00
|
|
|
|
'name': 'testing the post',
|
2017-10-05 10:46:55 +01:00
|
|
|
|
'organisation_type': organisation_type,
|
2019-03-26 12:35:32 +00:00
|
|
|
|
},
|
|
|
|
|
|
_expected_status=302,
|
|
|
|
|
|
_expected_redirect=url_for(
|
|
|
|
|
|
'main.service_dashboard',
|
|
|
|
|
|
service_id=101,
|
|
|
|
|
|
_external=True,
|
|
|
|
|
|
)
|
2017-10-04 11:49:32 +01:00
|
|
|
|
)
|
2017-02-03 12:07:21 +00:00
|
|
|
|
assert mock_get_services.called
|
|
|
|
|
|
mock_create_service.assert_called_once_with(
|
2018-04-19 14:01:45 +01:00
|
|
|
|
service_name='testing the post',
|
|
|
|
|
|
organisation_type=organisation_type,
|
|
|
|
|
|
message_limit=app_.config['DEFAULT_SERVICE_LIMIT'],
|
|
|
|
|
|
restricted=True,
|
2019-05-23 15:27:35 +01:00
|
|
|
|
user_id=api_user_active['id'],
|
2019-02-12 14:02:21 +00:00
|
|
|
|
email_from='testing.the.post',
|
2017-02-03 12:07:21 +00:00
|
|
|
|
)
|
|
|
|
|
|
assert len(mock_create_service_template.call_args_list) == 0
|
|
|
|
|
|
assert session['service_id'] == 101
|
2015-12-15 10:17:43 +00:00
|
|
|
|
|
|
|
|
|
|
|
2020-11-30 17:08:40 +00:00
|
|
|
|
@pytest.mark.parametrize('name, error_message', [
|
|
|
|
|
|
('', 'Cannot be empty'),
|
|
|
|
|
|
('.', 'Must include at least two alphanumeric characters'),
|
|
|
|
|
|
('a' * 256, 'Service name must be 255 characters or fewer'),
|
|
|
|
|
|
])
|
|
|
|
|
|
def test_add_service_fails_if_service_name_fails_validation(
|
2019-04-18 12:44:18 +01:00
|
|
|
|
client_request,
|
|
|
|
|
|
mock_get_organisation_by_domain,
|
2020-11-30 17:08:40 +00:00
|
|
|
|
name,
|
|
|
|
|
|
error_message,
|
2017-02-03 10:42:01 +00:00
|
|
|
|
):
|
2019-03-26 12:35:32 +00:00
|
|
|
|
page = client_request.post(
|
|
|
|
|
|
'main.add_service',
|
2020-11-30 17:08:40 +00:00
|
|
|
|
_data={"name": name},
|
2019-03-26 12:35:32 +00:00
|
|
|
|
_expected_status=200,
|
|
|
|
|
|
)
|
2020-11-30 17:08:40 +00:00
|
|
|
|
assert error_message in page.find("span", {"class": "govuk-error-message"}).text
|
2019-11-08 17:12:32 +00:00
|
|
|
|
|
|
|
|
|
|
|
2021-03-05 15:03:23 +00:00
|
|
|
|
@freeze_time("2021-01-01")
|
2017-02-03 10:42:01 +00:00
|
|
|
|
def test_should_return_form_errors_with_duplicate_service_name_regardless_of_case(
|
2019-03-26 12:35:32 +00:00
|
|
|
|
client_request,
|
2019-04-18 12:44:18 +01:00
|
|
|
|
mock_get_organisation_by_domain,
|
2021-02-15 11:41:26 +00:00
|
|
|
|
mocker,
|
2017-02-03 10:42:01 +00:00
|
|
|
|
):
|
2021-02-15 11:41:26 +00:00
|
|
|
|
def _create(**_kwargs):
|
|
|
|
|
|
json_mock = mocker.Mock(return_value={'message': {'name': ["Duplicate service name"]}})
|
|
|
|
|
|
resp_mock = mocker.Mock(status_code=400, json=json_mock)
|
|
|
|
|
|
http_error = HTTPError(response=resp_mock, message="Default message")
|
|
|
|
|
|
raise http_error
|
|
|
|
|
|
|
|
|
|
|
|
mocker.patch(
|
|
|
|
|
|
'app.service_api_client.create_service',
|
|
|
|
|
|
side_effect=_create
|
|
|
|
|
|
)
|
|
|
|
|
|
|
2019-03-26 12:35:32 +00:00
|
|
|
|
page = client_request.post(
|
|
|
|
|
|
'main.add_service',
|
|
|
|
|
|
_data={
|
2017-10-04 11:49:32 +01:00
|
|
|
|
'name': 'SERVICE ONE',
|
|
|
|
|
|
'organisation_type': 'central',
|
|
|
|
|
|
},
|
2019-03-26 12:35:32 +00:00
|
|
|
|
_expected_status=200,
|
|
|
|
|
|
)
|
2020-08-07 12:18:29 +01:00
|
|
|
|
assert 'This service name is already in use' in page.select_one('.govuk-error-message').text.strip()
|
2016-10-25 18:11:37 +01:00
|
|
|
|
|
|
|
|
|
|
|
2020-06-12 09:15:23 +01:00
|
|
|
|
def test_non_government_user_cannot_access_create_service_page(
|
2019-03-26 12:35:32 +00:00
|
|
|
|
client_request,
|
2017-02-03 10:42:01 +00:00
|
|
|
|
mock_get_non_govuser,
|
|
|
|
|
|
api_nongov_user_active,
|
2019-05-28 16:11:54 +01:00
|
|
|
|
mock_get_organisations,
|
2017-02-03 10:42:01 +00:00
|
|
|
|
):
|
2019-05-23 15:27:35 +01:00
|
|
|
|
assert is_gov_user(api_nongov_user_active['email_address']) is False
|
2019-03-26 12:35:32 +00:00
|
|
|
|
client_request.get(
|
|
|
|
|
|
'main.add_service',
|
|
|
|
|
|
_expected_status=403,
|
|
|
|
|
|
)
|
2016-10-28 10:48:29 +01:00
|
|
|
|
|
|
|
|
|
|
|
2020-06-12 09:15:23 +01:00
|
|
|
|
def test_non_government_user_cannot_create_service(
|
2019-03-26 12:35:32 +00:00
|
|
|
|
client_request,
|
2017-02-03 10:42:01 +00:00
|
|
|
|
mock_get_non_govuser,
|
|
|
|
|
|
api_nongov_user_active,
|
2019-05-28 16:11:54 +01:00
|
|
|
|
mock_get_organisations,
|
2017-02-03 10:42:01 +00:00
|
|
|
|
):
|
2019-05-23 15:27:35 +01:00
|
|
|
|
assert is_gov_user(api_nongov_user_active['email_address']) is False
|
2019-03-26 12:35:32 +00:00
|
|
|
|
client_request.post(
|
|
|
|
|
|
'main.add_service',
|
|
|
|
|
|
_data={'name': 'SERVICE TWO'},
|
|
|
|
|
|
_expected_status=403,
|
|
|
|
|
|
)
|