diff --git a/app/__init__.py b/app/__init__.py index 6733c699e..9c6405ef0 100644 --- a/app/__init__.py +++ b/app/__init__.py @@ -113,7 +113,6 @@ def register_blueprint(application): from app.events.rest import events as events_blueprint from app.provider_details.rest import provider_details as provider_details_blueprint from app.email_branding.rest import email_branding_blueprint - from app.dvla_organisation.rest import dvla_organisation_blueprint from app.delivery.rest import delivery_blueprint from app.inbound_number.rest import inbound_number_blueprint from app.inbound_sms.rest import inbound_sms as inbound_sms_blueprint @@ -184,9 +183,6 @@ def register_blueprint(application): email_branding_blueprint.before_request(requires_admin_auth) application.register_blueprint(email_branding_blueprint, url_prefix='/email-branding') - dvla_organisation_blueprint.before_request(requires_admin_auth) - application.register_blueprint(dvla_organisation_blueprint, url_prefix='/dvla_organisations') - letter_job.before_request(requires_admin_auth) application.register_blueprint(letter_job) diff --git a/app/dao/dvla_organisation_dao.py b/app/dao/dvla_organisation_dao.py deleted file mode 100644 index 879671947..000000000 --- a/app/dao/dvla_organisation_dao.py +++ /dev/null @@ -1,5 +0,0 @@ -from app.models import DVLAOrganisation - - -def dao_get_dvla_organisations(): - return DVLAOrganisation.query.all() diff --git a/app/dvla_organisation/__init__.py b/app/dvla_organisation/__init__.py deleted file mode 100644 index e69de29bb..000000000 diff --git a/app/dvla_organisation/rest.py b/app/dvla_organisation/rest.py deleted file mode 100644 index acf9e09e0..000000000 --- a/app/dvla_organisation/rest.py +++ /dev/null @@ -1,14 +0,0 @@ -from flask import Blueprint, jsonify - -from app.dao.dvla_organisation_dao import dao_get_dvla_organisations -from app.errors import register_errors - -dvla_organisation_blueprint = Blueprint('dvla_organisation', __name__) -register_errors(dvla_organisation_blueprint) - - -@dvla_organisation_blueprint.route('', methods=['GET']) -def get_dvla_organisations(): - return jsonify({ - org.id: org.name for org in dao_get_dvla_organisations() - }) diff --git a/app/models.py b/app/models.py index c4aea0ff4..0760eb750 100644 --- a/app/models.py +++ b/app/models.py @@ -238,17 +238,6 @@ service_email_branding = db.Table( ) -DVLA_ORG_HM_GOVERNMENT = '001' -DVLA_ORG_LAND_REGISTRY = '500' - - -class DVLAOrganisation(db.Model): - __tablename__ = 'dvla_organisation' - id = db.Column(db.String, primary_key=True) - name = db.Column(db.String(255), nullable=False) - filename = db.Column(db.String(255), nullable=False) - - class LetterBranding(db.Model): __tablename__ = 'letter_branding' id = db.Column(UUID(as_uuid=True), primary_key=True, default=uuid.uuid4) @@ -365,14 +354,6 @@ class Service(db.Model, Versioned): created_by = db.relationship('User') created_by_id = db.Column(UUID(as_uuid=True), db.ForeignKey('users.id'), index=True, nullable=False) prefix_sms = db.Column(db.Boolean, nullable=False, default=True) - dvla_organisation_id = db.Column( - db.String, - db.ForeignKey('dvla_organisation.id'), - index=True, - nullable=False, - default=DVLA_ORG_HM_GOVERNMENT - ) - dvla_organisation = db.relationship('DVLAOrganisation') organisation_type = db.Column( db.String(255), nullable=True, diff --git a/app/schemas.py b/app/schemas.py index 00bc611eb..8a4b1df20 100644 --- a/app/schemas.py +++ b/app/schemas.py @@ -204,7 +204,6 @@ class ServiceSchema(BaseSchema): created_by = field_for(models.Service, 'created_by', required=True) organisation_type = field_for(models.Service, 'organisation_type') - dvla_organisation = field_for(models.Service, 'dvla_organisation') letter_logo_filename = fields.Method(dump_only=True, serialize='get_letter_logo_filename') permissions = fields.Method("service_permissions") email_branding = field_for(models.Service, 'email_branding') @@ -286,7 +285,6 @@ class DetailedServiceSchema(BaseSchema): 'message_limit', 'email_from', 'inbound_api', - 'dvla_organisation', 'whitelist', 'reply_to_email_address', 'sms_sender', diff --git a/tests/app/dao/test_services_dao.py b/tests/app/dao/test_services_dao.py index ad7edd7d3..d25ba0c0e 100644 --- a/tests/app/dao/test_services_dao.py +++ b/tests/app/dao/test_services_dao.py @@ -45,7 +45,6 @@ from app.models import ( InvitedUser, Service, ServicePermission, - DVLA_ORG_HM_GOVERNMENT, KEY_TYPE_NORMAL, KEY_TYPE_TEAM, KEY_TYPE_TEST, @@ -89,7 +88,6 @@ def test_create_service(notify_db_session): service_db = Service.query.one() assert service_db.name == "service_name" assert service_db.id == service.id - assert service_db.dvla_organisation_id == DVLA_ORG_HM_GOVERNMENT assert service_db.email_from == 'email_from' assert service_db.research_mode is False assert service_db.prefix_sms is True @@ -370,8 +368,6 @@ def test_create_service_creates_a_history_record_with_current_data(notify_db_ses assert service_from_db.version == service_history.version assert user.id == service_history.created_by_id assert service_from_db.created_by.id == service_history.created_by_id - assert service_from_db.dvla_organisation_id == DVLA_ORG_HM_GOVERNMENT - assert service_history.dvla_organisation_id == DVLA_ORG_HM_GOVERNMENT def test_update_service_creates_a_history_record_with_current_data(notify_db_session): diff --git a/tests/app/dvla_organisation/__init__.py b/tests/app/dvla_organisation/__init__.py deleted file mode 100644 index e69de29bb..000000000 diff --git a/tests/app/dvla_organisation/test_rest.py b/tests/app/dvla_organisation/test_rest.py deleted file mode 100644 index 8bf4f71ab..000000000 --- a/tests/app/dvla_organisation/test_rest.py +++ /dev/null @@ -1,14 +0,0 @@ -from flask import json - -from tests import create_authorization_header - - -def test_get_dvla_organisations(client): - auth_header = create_authorization_header() - - response = client.get('/dvla_organisations', headers=[auth_header]) - - assert response.status_code == 200 - dvla_organisations = json.loads(response.get_data(as_text=True)) - assert dvla_organisations['001'] == 'HM Government' - assert dvla_organisations['500'] == 'Land Registry' diff --git a/tests/app/service/test_rest.py b/tests/app/service/test_rest.py index 31b250e76..c8aaee67f 100644 --- a/tests/app/service/test_rest.py +++ b/tests/app/service/test_rest.py @@ -23,7 +23,6 @@ from app.models import ( ServicePermission, ServiceSmsSender, User, - DVLA_ORG_LAND_REGISTRY, KEY_TYPE_NORMAL, KEY_TYPE_TEAM, KEY_TYPE_TEST, EMAIL_TYPE, SMS_TYPE, LETTER_TYPE, EDIT_FOLDERS, INTERNATIONAL_SMS_TYPE, INBOUND_SMS_TYPE, @@ -139,7 +138,6 @@ def test_get_service_by_id(admin_request, sample_service): assert not json_resp['data']['research_mode'] assert json_resp['data']['email_branding'] is None assert 'branding' not in json_resp['data'] - assert json_resp['data']['dvla_organisation'] == '001' assert json_resp['data']['prefix_sms'] is True assert json_resp['data']['letter_logo_filename'] is None @@ -235,7 +233,6 @@ def test_create_service(admin_request, sample_user): assert json_resp['data']['name'] == 'created service' assert json_resp['data']['email_from'] == 'created.service' assert not json_resp['data']['research_mode'] - assert json_resp['data']['dvla_organisation'] == '001' assert json_resp['data']['rate_limit'] == 3000 assert json_resp['data']['letter_branding'] is None @@ -271,7 +268,6 @@ def test_create_service_with_domain_sets_letter_branding(admin_request, sample_u 'service_domain': letter_branding.domain } json_resp = admin_request.post('service.create_service', _data=data, _expected_status=201) - assert json_resp['data']['dvla_organisation'] == '001' assert json_resp['data']['letter_branding'] == str(letter_branding.id) assert json_resp['data']['letter_logo_filename'] == str(letter_branding.filename) @@ -316,7 +312,6 @@ def test_get_service_by_id_returns_letter_branding( json_resp = resp.json assert json_resp['data']['name'] == sample_service.name assert json_resp['data']['id'] == str(sample_service.id) - assert json_resp['data']['dvla_organisation'] == '001' assert json_resp['data']['letter_branding'] == str(letter_branding.id) assert json_resp['data']['letter_logo_filename'] == 'test-domain' @@ -478,7 +473,6 @@ def test_update_service(client, notify_db, sample_service): 'email_from': 'updated.service.name', 'created_by': str(sample_service.created_by.id), 'email_branding': str(brand.id), - 'dvla_organisation': DVLA_ORG_LAND_REGISTRY, 'organisation_type': 'foo', } @@ -494,7 +488,6 @@ def test_update_service(client, notify_db, sample_service): assert result['data']['name'] == 'updated service name' assert result['data']['email_from'] == 'updated.service.name' assert result['data']['email_branding'] == str(brand.id) - assert result['data']['dvla_organisation'] == DVLA_ORG_LAND_REGISTRY assert result['data']['organisation_type'] == 'foo'