mirror of
https://github.com/GSA/notifications-api.git
synced 2026-09-09 09:49:49 -04:00
Provider Statistics added.
Rates command added with a test. Updated to include added migration.
This commit is contained in:
73
tests/app/dao/test_notifications_dao_provider_statistics.py
Normal file
73
tests/app/dao/test_notifications_dao_provider_statistics.py
Normal file
@@ -0,0 +1,73 @@
|
||||
from datetime import datetime
|
||||
from app.models import ProviderStatistics
|
||||
|
||||
from app.dao.provider_statistics_dao import get_provider_statistics
|
||||
from app.models import Notification
|
||||
from tests.app.conftest import sample_notification as create_sample_notification
|
||||
|
||||
|
||||
def test_should_update_provider_statistics_sms(notify_db,
|
||||
notify_db_session,
|
||||
sample_template,
|
||||
mmg_provider_name):
|
||||
notification = create_sample_notification(
|
||||
notify_db,
|
||||
notify_db_session,
|
||||
template=sample_template)
|
||||
provider_stats = get_provider_statistics(sample_template.service, mmg_provider_name)
|
||||
assert provider_stats.unit_count == 1
|
||||
|
||||
|
||||
def test_should_update_provider_statistics_email(notify_db,
|
||||
notify_db_session,
|
||||
sample_email_template,
|
||||
ses_provider_name):
|
||||
notification = create_sample_notification(
|
||||
notify_db,
|
||||
notify_db_session,
|
||||
template=sample_email_template)
|
||||
provider_stats = get_provider_statistics(sample_email_template.service, ses_provider_name)
|
||||
assert provider_stats.unit_count == 1
|
||||
|
||||
|
||||
def test_should_update_provider_statistics_sms_multi(notify_db,
|
||||
notify_db_session,
|
||||
sample_template,
|
||||
mmg_provider_name):
|
||||
notification1 = create_sample_notification(
|
||||
notify_db,
|
||||
notify_db_session,
|
||||
template=sample_template,
|
||||
content_char_count=160)
|
||||
notification1 = create_sample_notification(
|
||||
notify_db,
|
||||
notify_db_session,
|
||||
template=sample_template,
|
||||
content_char_count=161)
|
||||
notification1 = create_sample_notification(
|
||||
notify_db,
|
||||
notify_db_session,
|
||||
template=sample_template,
|
||||
content_char_count=307)
|
||||
provider_stats = get_provider_statistics(sample_template.service, mmg_provider_name)
|
||||
assert provider_stats.unit_count == 6
|
||||
|
||||
|
||||
def test_should_update_provider_statistics_email_multi(notify_db,
|
||||
notify_db_session,
|
||||
sample_email_template,
|
||||
ses_provider_name):
|
||||
notification1 = create_sample_notification(
|
||||
notify_db,
|
||||
notify_db_session,
|
||||
template=sample_email_template)
|
||||
notification2 = create_sample_notification(
|
||||
notify_db,
|
||||
notify_db_session,
|
||||
template=sample_email_template)
|
||||
notification3 = create_sample_notification(
|
||||
notify_db,
|
||||
notify_db_session,
|
||||
template=sample_email_template)
|
||||
provider_stats = get_provider_statistics(sample_email_template.service, ses_provider_name)
|
||||
assert provider_stats.unit_count == 3
|
||||
Reference in New Issue
Block a user