Validate service and organisation name

This commit is contained in:
Pea Tyczynska
2019-11-08 17:12:32 +00:00
parent 21a59598b2
commit 21e6d994b9
6 changed files with 87 additions and 3 deletions

View File

@@ -160,6 +160,29 @@ def test_create_new_organisation_validates(
assert mock_create_organisation.called is False
def test_create_new_organisation_fails_if_new_name_has_less_than_2_alphanumeric_characters(
client_request,
platform_admin_user,
mocker,
):
mock_create_organisation = mocker.patch(
'app.organisations_client.create_organisation'
)
client_request.login(platform_admin_user)
page = client_request.post(
'.add_organisation',
_data={
'name': ".",
'organisation_type': 'local',
'crown_status': 'non-crown',
},
_expected_status=200,
)
assert mock_create_organisation.called is False
assert page.find("span", {"class": "error-message"})
@pytest.mark.parametrize('organisation_type, organisation, expected_status', (
('nhs_gp', None, 200),
('central', None, 403),