mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-07-24 09:58:43 -04:00
Update organisation notes
This commit is contained in:
@@ -542,12 +542,12 @@ def edit_organisation_notes(org_id):
|
||||
if form.validate_on_submit():
|
||||
|
||||
if form.notes.data == current_organisation.notes:
|
||||
return redirect(url_for('.organisation_settings', service_id=org_id))
|
||||
return redirect(url_for('.organisation_settings', org_id=org_id))
|
||||
|
||||
current_organisation.update(
|
||||
notes=form.notes.data
|
||||
)
|
||||
return redirect(url_for('.organisation_settings', service_id=org_id))
|
||||
return redirect(url_for('.organisation_settings', org_id=org_id))
|
||||
|
||||
return render_template(
|
||||
'views/organisations/organisation/settings/edit-organisation-notes.html',
|
||||
|
||||
@@ -80,7 +80,7 @@
|
||||
|
||||
{% call row() %}
|
||||
{{ text_field('Notes')}}
|
||||
{{ optional_text_field(current_service.notes, default="No notes yet", wrap=True) }}
|
||||
{{ optional_text_field(current_org.notes, default="No notes yet", wrap=True) }}
|
||||
{{ edit_field('Change', url_for('.edit_organisation_notes', org_id=current_org.id), suffix='the notes for the organisation') }}
|
||||
{% endcall %}
|
||||
|
||||
|
||||
@@ -1289,3 +1289,27 @@ def test_view_edit_organisation_notes(
|
||||
assert page.select_one('h1').text == "Edit organisation notes"
|
||||
assert page.find('label', class_="form-label").text.strip() == "Notes"
|
||||
assert page.find('textarea').attrs["name"] == "notes"
|
||||
|
||||
|
||||
def test_update_organisation_notes(
|
||||
platform_admin_client,
|
||||
organisation_one,
|
||||
mock_get_organisation,
|
||||
mock_update_organisation,
|
||||
):
|
||||
response = platform_admin_client.post(
|
||||
url_for(
|
||||
'main.edit_organisation_notes',
|
||||
org_id=organisation_one['id'],
|
||||
),
|
||||
data={'notes': "Very fluffy"}
|
||||
)
|
||||
assert response.status_code == 302
|
||||
settings_url = url_for(
|
||||
'main.organisation_settings', org_id=organisation_one['id'], _external=True)
|
||||
assert settings_url == response.location
|
||||
mock_update_organisation.assert_called_with(
|
||||
organisation_one['id'],
|
||||
cached_service_ids=None,
|
||||
notes="Very fluffy"
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user