mirror of
https://github.com/GSA/notifications-api.git
synced 2026-02-01 23:55:58 -05:00
Renamed migration script and refactor code
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
from app import db
|
||||
from app.dao.dao_utils import transactional, version_class
|
||||
from app.dao.dao_utils import transactional
|
||||
from app.models import Organisation
|
||||
|
||||
|
||||
|
||||
@@ -1,14 +1,11 @@
|
||||
from flask import Blueprint, jsonify, request
|
||||
|
||||
from app.dao.organisations_dao import (
|
||||
dao_create_organisation,
|
||||
dao_get_organisations,
|
||||
dao_get_organisation_by_id,
|
||||
dao_create_organisation
|
||||
)
|
||||
from app.errors import (
|
||||
InvalidRequest,
|
||||
register_errors
|
||||
)
|
||||
from app.errors import register_errors
|
||||
from app.models import Organisation
|
||||
from app.organisation.organisation_schema import post_organisation_schema
|
||||
from app.schema_validation import validate
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
"""empty message
|
||||
|
||||
Revision ID: 0105_change_logo_not_nullable
|
||||
Revises: 0104_more_letter_orgs
|
||||
Revision ID: 0106_change_logo_not_nullable
|
||||
Revises: 0105_opg_letter_org
|
||||
Create Date: 2017-07-06 10:14:35.188404
|
||||
|
||||
"""
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = '0105_change_logo_not_nullable'
|
||||
down_revision = '0104_more_letter_orgs'
|
||||
revision = '0106_change_logo_not_nullable'
|
||||
down_revision = '0105_opg_letter_org'
|
||||
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
@@ -39,7 +39,7 @@ from app.dao.invited_user_dao import save_invited_user
|
||||
from app.dao.provider_rates_dao import create_provider_rates
|
||||
from app.clients.sms.firetext import FiretextClient
|
||||
from tests import create_authorization_header
|
||||
from tests.app.db import create_user, create_template, create_notification, create_organisation
|
||||
from tests.app.db import create_user, create_template, create_notification
|
||||
|
||||
|
||||
@pytest.yield_fixture
|
||||
@@ -974,10 +974,6 @@ def sample_provider_rate(notify_db, notify_db_session, valid_from=None, rate=Non
|
||||
)
|
||||
|
||||
|
||||
def sample_organisation(notify_db, notify_db_session):
|
||||
create_organisation()
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def restore_provider_details(notify_db, notify_db_session):
|
||||
"""
|
||||
|
||||
@@ -35,12 +35,14 @@ def test_create_organisation_without_logo_raises_error(notify_db, notify_db_sess
|
||||
|
||||
|
||||
def test_get_organisations_gets_all_organisations(notify_db, notify_db_session):
|
||||
create_organisation(name='test_org_1')
|
||||
create_organisation(name='test_org_2')
|
||||
org_1 = create_organisation(name='test_org_1')
|
||||
org_2 = create_organisation(name='test_org_2')
|
||||
|
||||
organisations = dao_get_organisations()
|
||||
|
||||
assert len(organisations) == 2
|
||||
assert org_1 == organisations[0]
|
||||
assert org_2 == organisations[1]
|
||||
|
||||
|
||||
def test_get_organisation_by_id_gets_correct_organisation(notify_db, notify_db_session):
|
||||
|
||||
Reference in New Issue
Block a user