mirror of
https://github.com/GSA/notifications-api.git
synced 2026-02-03 09:51:11 -05:00
Set up clients wrapper to hold all the clients
- tests FAIL if there is a provider in the DB and not in the CODE - tests PASS is there a provider in the CODE and not in the DB
This commit is contained in:
24
tests/app/dao/test_provider_details.py
Normal file
24
tests/app/dao/test_provider_details.py
Normal file
@@ -0,0 +1,24 @@
|
||||
from app.models import ProviderDetails
|
||||
from app import clients
|
||||
|
||||
|
||||
def test_should_error_if_any_provider_in_database_not_in_code(notify_db, notify_db_session, notify_api):
|
||||
providers = ProviderDetails.query.all()
|
||||
|
||||
for provider in providers:
|
||||
if provider.notification_type == 'sms':
|
||||
assert clients.sms_client(provider.identifier)
|
||||
if provider.notification_type == 'email':
|
||||
assert clients.email_client(provider.identifier)
|
||||
|
||||
|
||||
def test_should_not_error_if_any_provider_in_code_not_in_database(notify_db, notify_db_session, notify_api):
|
||||
providers = ProviderDetails.query.all()
|
||||
|
||||
ProviderDetails.query.filter_by(identifier='mmg').delete()
|
||||
|
||||
for provider in providers:
|
||||
if provider.notification_type == 'sms':
|
||||
assert clients.sms_client(provider.identifier)
|
||||
if provider.notification_type == 'email':
|
||||
assert clients.email_client(provider.identifier)
|
||||
Reference in New Issue
Block a user