mirror of
https://github.com/GSA/notifications-api.git
synced 2026-02-03 01:41:05 -05:00
Ensure get_current_provider only returns active
This commit is contained in:
@@ -36,7 +36,8 @@ def get_alternative_sms_provider(identifier):
|
|||||||
|
|
||||||
def get_current_provider(notification_type):
|
def get_current_provider(notification_type):
|
||||||
return ProviderDetails.query.filter_by(
|
return ProviderDetails.query.filter_by(
|
||||||
notification_type=notification_type
|
notification_type=notification_type,
|
||||||
|
active=True
|
||||||
).order_by(
|
).order_by(
|
||||||
asc(ProviderDetails.priority)
|
asc(ProviderDetails.priority)
|
||||||
).first()
|
).first()
|
||||||
|
|||||||
@@ -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)
|
dao_get_sms_provider_with_equal_priority(current_provider.identifier, current_provider.priority)
|
||||||
|
|
||||||
assert conflicting_provider
|
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