mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-08-23 15:57:23 -04:00
DRY-up creating provider fixtures
This commit is contained in:
@@ -7,106 +7,93 @@ from flask import url_for
|
|||||||
from app.main.views.providers import add_monthly_traffic
|
from app.main.views.providers import add_monthly_traffic
|
||||||
|
|
||||||
|
|
||||||
|
def provider_json(overrides):
|
||||||
|
provider = {
|
||||||
|
'id': 'override-me',
|
||||||
|
'active': True,
|
||||||
|
'priority': 20,
|
||||||
|
'display_name': 'Provider',
|
||||||
|
'identifier': 'override-me',
|
||||||
|
'notification_type': 'sms',
|
||||||
|
'updated_at': None,
|
||||||
|
'version': 1,
|
||||||
|
'created_by_name': None,
|
||||||
|
'supports_international': False,
|
||||||
|
'current_month_billable_sms': 0,
|
||||||
|
}
|
||||||
|
|
||||||
|
provider.update(**overrides)
|
||||||
|
return provider
|
||||||
|
|
||||||
|
|
||||||
@pytest.fixture
|
@pytest.fixture
|
||||||
def sms_provider_1():
|
def sms_provider_1():
|
||||||
return {
|
return provider_json({
|
||||||
'id': 'sms_provider_1-id',
|
'id': 'sms_provider_1-id',
|
||||||
'active': True,
|
|
||||||
'priority': 20,
|
'priority': 20,
|
||||||
'display_name': 'SMS Provider 1',
|
'display_name': 'SMS Provider 1',
|
||||||
'identifier': 'sms_provider_1',
|
'identifier': 'sms_provider_1',
|
||||||
'notification_type': 'sms',
|
'notification_type': 'sms',
|
||||||
'updated_at': datetime(2017, 1, 16, 15, 20, 40).isoformat(),
|
'updated_at': datetime(2017, 1, 16, 15, 20, 40).isoformat(),
|
||||||
'version': 1,
|
|
||||||
'created_by_name': 'Test User',
|
'created_by_name': 'Test User',
|
||||||
'supports_international': False,
|
|
||||||
'current_month_billable_sms': 5020,
|
'current_month_billable_sms': 5020,
|
||||||
}
|
})
|
||||||
|
|
||||||
|
|
||||||
@pytest.fixture
|
@pytest.fixture
|
||||||
def sms_provider_2():
|
def sms_provider_2():
|
||||||
return {
|
return provider_json({
|
||||||
'id': 'sms_provider_2-id',
|
'id': 'sms_provider_2-id',
|
||||||
'active': True,
|
|
||||||
'priority': 10,
|
'priority': 10,
|
||||||
'display_name': 'SMS Provider 2',
|
'display_name': 'SMS Provider 2',
|
||||||
'identifier': 'sms_provider_2',
|
'identifier': 'sms_provider_2',
|
||||||
'notification_type': 'sms',
|
'notification_type': 'sms',
|
||||||
'updated_at': None,
|
|
||||||
'version': 1,
|
|
||||||
'created_by': None,
|
|
||||||
'supports_international': False,
|
|
||||||
'current_month_billable_sms': 6891,
|
'current_month_billable_sms': 6891,
|
||||||
}
|
})
|
||||||
|
|
||||||
|
|
||||||
@pytest.fixture
|
@pytest.fixture
|
||||||
def email_provider_1():
|
def email_provider_1():
|
||||||
return {
|
return provider_json({
|
||||||
'id': 'email_provider_1-id',
|
'id': 'email_provider_1-id',
|
||||||
'active': True,
|
|
||||||
'priority': 1,
|
|
||||||
'display_name': 'Email Provider 1',
|
'display_name': 'Email Provider 1',
|
||||||
'identifier': 'email_provider_1',
|
'identifier': 'email_provider_1',
|
||||||
'notification_type': 'email',
|
'notification_type': 'email',
|
||||||
'updated_at': None,
|
})
|
||||||
'version': 1,
|
|
||||||
'created_by': None,
|
|
||||||
'supports_international': False,
|
|
||||||
'current_month_billable_sms': 0,
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@pytest.fixture
|
@pytest.fixture
|
||||||
def email_provider_2():
|
def email_provider_2():
|
||||||
return {
|
return provider_json({
|
||||||
'id': 'email_provider_2-id',
|
'id': 'email_provider_2-id',
|
||||||
'active': True,
|
|
||||||
'priority': 2,
|
|
||||||
'display_name': 'Email Provider 2',
|
'display_name': 'Email Provider 2',
|
||||||
'identifier': 'email_provider_2',
|
'identifier': 'email_provider_2',
|
||||||
'notification_type': 'email',
|
'notification_type': 'email',
|
||||||
'updated_at': None,
|
})
|
||||||
'version': 1,
|
|
||||||
'created_by': None,
|
|
||||||
'supports_international': False,
|
|
||||||
'current_month_billable_sms': 0,
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@pytest.fixture
|
@pytest.fixture
|
||||||
def sms_provider_intl_1():
|
def sms_provider_intl_1():
|
||||||
return {
|
return provider_json({
|
||||||
'id': 'sms_provider_intl_1-id',
|
'id': 'sms_provider_intl_1-id',
|
||||||
'active': False,
|
'active': False,
|
||||||
'priority': 10,
|
|
||||||
'display_name': 'SMS Provider Intl 1',
|
'display_name': 'SMS Provider Intl 1',
|
||||||
'identifier': 'sms_provider_intl_1',
|
'identifier': 'sms_provider_intl_1',
|
||||||
'notification_type': 'sms',
|
'notification_type': 'sms',
|
||||||
'updated_at': None,
|
|
||||||
'version': 1,
|
|
||||||
'created_by': None,
|
|
||||||
'supports_international': True,
|
'supports_international': True,
|
||||||
'current_month_billable_sms': 0,
|
})
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@pytest.fixture
|
@pytest.fixture
|
||||||
def sms_provider_intl_2():
|
def sms_provider_intl_2():
|
||||||
return {
|
return provider_json({
|
||||||
'id': 'sms_provider_intl_2-id',
|
'id': 'sms_provider_intl_2-id',
|
||||||
'active': False,
|
'active': False,
|
||||||
'priority': 10,
|
|
||||||
'display_name': 'SMS Provider Intl 2',
|
'display_name': 'SMS Provider Intl 2',
|
||||||
'identifier': 'sms_provider_intl_2',
|
'identifier': 'sms_provider_intl_2',
|
||||||
'notification_type': 'sms',
|
'notification_type': 'sms',
|
||||||
'updated_at': None,
|
|
||||||
'version': 1,
|
|
||||||
'created_by': None,
|
|
||||||
'supports_international': True,
|
'supports_international': True,
|
||||||
'current_month_billable_sms': 0,
|
})
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@pytest.fixture
|
@pytest.fixture
|
||||||
|
|||||||
Reference in New Issue
Block a user