mirror of
https://github.com/GSA/notifications-api.git
synced 2026-02-01 07:35:34 -05:00
Change Organisation DAO update method
- Changed the organisation DAO update method to only make 1 query - Updated the update rest endpoint to not return an organisation when the update is successful
This commit is contained in:
@@ -45,7 +45,7 @@ def test_update_organisation(notify_db, notify_db_session):
|
||||
assert len(organisation) == 1
|
||||
assert organisation[0].name != updated_name
|
||||
|
||||
dao_update_organisation(organisation[0], name=updated_name)
|
||||
dao_update_organisation(organisation[0].id, **{'name': updated_name})
|
||||
|
||||
organisation = Organisation.query.all()
|
||||
|
||||
|
||||
@@ -79,7 +79,7 @@ def test_post_update_organisation_updates_fields(admin_request, notify_db_sessio
|
||||
'organisation.update_organisation',
|
||||
_data=data,
|
||||
organisation_id=org.id,
|
||||
_expected_status=200
|
||||
_expected_status=204
|
||||
)
|
||||
|
||||
organisation = Organisation.query.all()
|
||||
@@ -88,3 +88,18 @@ def test_post_update_organisation_updates_fields(admin_request, notify_db_sessio
|
||||
assert organisation[0].id == org.id
|
||||
assert organisation[0].name == data['name']
|
||||
assert organisation[0].active == data['active']
|
||||
|
||||
|
||||
def test_post_update_organisation_gives_404_status_if_org_does_not_exist(admin_request, notify_db_session):
|
||||
data = {'name': 'new organisation name'}
|
||||
|
||||
admin_request.post(
|
||||
'organisation.update_organisation',
|
||||
_data=data,
|
||||
organisation_id='31d42ce6-3dac-45a7-95cb-94423d5ca03c',
|
||||
_expected_status=404
|
||||
)
|
||||
|
||||
organisation = Organisation.query.all()
|
||||
|
||||
assert not organisation
|
||||
|
||||
Reference in New Issue
Block a user