mirror of
https://github.com/GSA/notifications-api.git
synced 2026-02-03 18:01:08 -05:00
Removed dao_update_organisation
This commit is contained in:
@@ -14,8 +14,3 @@ def dao_get_organisation_by_id(org_id):
|
||||
@transactional
|
||||
def dao_create_organisation(organisation):
|
||||
db.session.add(organisation)
|
||||
|
||||
|
||||
@transactional
|
||||
def dao_update_organisation(organisation):
|
||||
db.session.add(organisation)
|
||||
|
||||
@@ -2,7 +2,6 @@ from flask import Blueprint, jsonify, request
|
||||
|
||||
from app.dao.organisations_dao import (
|
||||
dao_create_organisation,
|
||||
dao_update_organisation,
|
||||
dao_get_organisations,
|
||||
dao_get_organisation_by_id,
|
||||
)
|
||||
@@ -41,12 +40,11 @@ def create_organisation():
|
||||
|
||||
@organisation_blueprint.route('/<uuid:organisation_id>', methods=['POST'])
|
||||
def update_organisation(organisation_id):
|
||||
fetched_organisation = dao_get_organisation_by_id(organisation_id)
|
||||
|
||||
data = request.get_json()
|
||||
|
||||
validate(data, post_update_organisation_schema)
|
||||
|
||||
fetched_organisation = dao_get_organisation_by_id(organisation_id)
|
||||
for key in data.keys():
|
||||
setattr(fetched_organisation, key, data[key])
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@ from sqlalchemy.exc import IntegrityError
|
||||
from app.dao.organisations_dao import (
|
||||
dao_create_organisation,
|
||||
dao_get_organisations,
|
||||
dao_get_organisation_by_id, dao_update_organisation
|
||||
dao_get_organisation_by_id
|
||||
)
|
||||
from app.models import Organisation
|
||||
|
||||
@@ -60,9 +60,8 @@ def test_update_organisation(notify_db, notify_db_session):
|
||||
organisation_from_db = Organisation.query.first()
|
||||
assert organisation_from_db.name != updated_name
|
||||
|
||||
organisation.name = updated_name
|
||||
setattr(organisation_from_db, 'name', updated_name)
|
||||
|
||||
dao_update_organisation(organisation)
|
||||
organisation_from_db = Organisation.query.first()
|
||||
organisation_from_db_again = Organisation.query.first()
|
||||
|
||||
assert organisation_from_db.name == updated_name
|
||||
assert organisation_from_db_again.name == updated_name
|
||||
|
||||
@@ -84,7 +84,7 @@ def test_post_create_organisation_without_name_or_colour_is_valid(admin_request,
|
||||
|
||||
@pytest.mark.parametrize('data_update', [
|
||||
({'name': 'test organisation 1'}),
|
||||
({'logo': 'images/text_x3.png', 'colour': '#ffffff'})
|
||||
({'logo': 'images/text_x3.png', 'colour': '#ffffff'}),
|
||||
])
|
||||
def test_post_update_organisation_updates_field(admin_request, notify_db_session, data_update):
|
||||
data = {
|
||||
|
||||
Reference in New Issue
Block a user