mirror of
https://github.com/GSA/notifications-api.git
synced 2026-02-05 02:41:14 -05:00
Merge branch 'master' into update-sms-rate
This commit is contained in:
@@ -36,7 +36,8 @@ def get_alternative_sms_provider(identifier):
|
||||
|
||||
def get_current_provider(notification_type):
|
||||
return ProviderDetails.query.filter_by(
|
||||
notification_type=notification_type
|
||||
notification_type=notification_type,
|
||||
active=True
|
||||
).order_by(
|
||||
asc(ProviderDetails.priority)
|
||||
).first()
|
||||
|
||||
@@ -151,6 +151,7 @@ class Service(db.Model, Versioned):
|
||||
restricted = db.Column(db.Boolean, index=False, unique=False, nullable=False)
|
||||
research_mode = db.Column(db.Boolean, index=False, unique=False, nullable=False, default=False)
|
||||
can_send_letters = db.Column(db.Boolean, nullable=False, default=False)
|
||||
can_send_international_sms = db.Column(db.Boolean, nullable=False, default=False)
|
||||
email_from = db.Column(db.Text, index=False, unique=True, nullable=False)
|
||||
created_by = db.relationship('User')
|
||||
created_by_id = db.Column(UUID(as_uuid=True), db.ForeignKey('users.id'), index=True, nullable=False)
|
||||
|
||||
24
migrations/versions/0073_add_international_sms_flag.py
Normal file
24
migrations/versions/0073_add_international_sms_flag.py
Normal file
@@ -0,0 +1,24 @@
|
||||
"""empty message
|
||||
|
||||
Revision ID: 0073_add_international_sms_flag
|
||||
Revises: 0072_add_dvla_orgs
|
||||
Create Date: 2017-10-25 17:37:27.660723
|
||||
|
||||
"""
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = '0073_add_international_sms_flag'
|
||||
down_revision = '0072_add_dvla_orgs'
|
||||
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
|
||||
|
||||
def upgrade():
|
||||
op.add_column('services', sa.Column('can_send_international_sms', sa.Boolean(), nullable=False, server_default=sa.false()))
|
||||
op.add_column('services_history', sa.Column('can_send_international_sms', sa.Boolean(), nullable=False, server_default=sa.false()))
|
||||
|
||||
|
||||
def downgrade():
|
||||
op.drop_column('services_history', 'can_send_international_sms')
|
||||
op.drop_column('services', 'can_send_international_sms')
|
||||
@@ -273,3 +273,12 @@ def test_get_sms_provider_with_equal_priority_returns_provider(
|
||||
dao_get_sms_provider_with_equal_priority(current_provider.identifier, current_provider.priority)
|
||||
|
||||
assert conflicting_provider
|
||||
|
||||
|
||||
def test_get_current_sms_provider_returns_active_only(restore_provider_details):
|
||||
current_provider = get_current_provider('sms')
|
||||
current_provider.active = False
|
||||
dao_update_provider_details(current_provider)
|
||||
new_current_provider = get_current_provider('sms')
|
||||
|
||||
assert current_provider.identifier != new_current_provider.identifier
|
||||
|
||||
Reference in New Issue
Block a user