mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-08-02 20:59:39 -04:00
Update RenameOrganisationForm with new fields
Changes its StringFields to GovukTextInputFields. This change also affects NewOrganisationForm, which inherits from RenameOrganisationForm. Also includes changes to templates that use this form and associated tests.
This commit is contained in:
@@ -1033,7 +1033,7 @@ class RenameServiceForm(StripWhitespaceForm):
|
||||
|
||||
|
||||
class RenameOrganisationForm(StripWhitespaceForm):
|
||||
name = StringField(
|
||||
name = GovukTextInputField(
|
||||
u'Organisation name',
|
||||
validators=[
|
||||
DataRequired(message='Cannot be empty'),
|
||||
|
||||
@@ -26,9 +26,9 @@
|
||||
{% block content %}
|
||||
{{ page_header('New organisation') }}
|
||||
{% call form_wrapper() %}
|
||||
{{textbox(form.name)}}
|
||||
{{radios(form.organisation_type)}}
|
||||
{{radios(form.crown_status)}}
|
||||
{{ form.name }}
|
||||
{{ radios(form.organisation_type) }}
|
||||
{{ radios(form.crown_status) }}
|
||||
{{ page_footer('Save') }}
|
||||
{% endcall %}
|
||||
{% endblock %}
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
) }}
|
||||
|
||||
{% call form_wrapper() %}
|
||||
{{textbox(form.name)}}
|
||||
{{ form.name }}
|
||||
{{ page_footer('Save') }}
|
||||
{% endcall %}
|
||||
|
||||
|
||||
@@ -88,10 +88,10 @@ def test_page_to_create_new_organisation(
|
||||
page = client_request.get('.add_organisation')
|
||||
|
||||
assert [
|
||||
(input['type'], input['name'], input['value'])
|
||||
(input['type'], input['name'], input.get('value'))
|
||||
for input in page.select('input')
|
||||
] == [
|
||||
('text', 'name', ''),
|
||||
('text', 'name', None),
|
||||
('radio', 'organisation_type', 'central'),
|
||||
('radio', 'organisation_type', 'local'),
|
||||
('radio', 'organisation_type', 'nhs_central'),
|
||||
@@ -155,9 +155,9 @@ def test_create_new_organisation_validates(
|
||||
)
|
||||
assert [
|
||||
(error['data-error-label'], normalize_spaces(error.text))
|
||||
for error in page.select('.error-message')
|
||||
for error in page.select('.govuk-error-message, .error-message')
|
||||
] == [
|
||||
('name', 'Cannot be empty'),
|
||||
('name', 'Error: Cannot be empty'),
|
||||
('organisation_type', 'Select the type of organisation'),
|
||||
('crown_status', 'Select whether this organisation is a crown body'),
|
||||
]
|
||||
@@ -184,7 +184,7 @@ def test_create_new_organisation_fails_if_new_name_has_less_than_2_alphanumeric_
|
||||
_expected_status=200,
|
||||
)
|
||||
assert mock_create_organisation.called is False
|
||||
assert page.find("span", {"class": "error-message"})
|
||||
assert page.find("span", {"class": "govuk-error-message"})
|
||||
|
||||
|
||||
@pytest.mark.parametrize('organisation_type, organisation, expected_status', (
|
||||
@@ -1056,9 +1056,7 @@ def test_update_organisation_with_incorrect_input(
|
||||
assert response.status_code == 200
|
||||
page = BeautifulSoup(response.data.decode('utf-8'), 'html.parser')
|
||||
|
||||
assert normalize_spaces(
|
||||
page.select_one('.error-message').text
|
||||
) == "Cannot be empty"
|
||||
assert "Cannot be empty" in page.select_one('.govuk-error-message').text
|
||||
|
||||
|
||||
def test_update_organisation_with_non_unique_name(
|
||||
@@ -1075,9 +1073,7 @@ def test_update_organisation_with_non_unique_name(
|
||||
assert response.status_code == 200
|
||||
page = BeautifulSoup(response.data.decode('utf-8'), 'html.parser')
|
||||
|
||||
assert normalize_spaces(
|
||||
page.select_one('.error-message').text
|
||||
) == 'This organisation name is already in use'
|
||||
assert 'This organisation name is already in use' in page.select_one('.govuk-error-message').text
|
||||
|
||||
assert mock_organisation_name_is_not_unique.called
|
||||
|
||||
|
||||
Reference in New Issue
Block a user