Provider Statistics added.

Rates command added with a test.

Updated to include added migration.
This commit is contained in:
Nicholas Staples
2016-04-21 11:37:38 +01:00
parent a38e4f4965
commit 3b1423a2ea
15 changed files with 393 additions and 123 deletions

View File

@@ -292,7 +292,10 @@ def sample_notification(notify_db,
to_field=None,
status='sending',
reference=None,
created_at=datetime.utcnow()):
created_at=datetime.utcnow(),
provider_name=None,
content_char_count=160,
create=True):
if service is None:
service = sample_service(notify_db, notify_db_session)
if template is None:
@@ -302,6 +305,9 @@ def sample_notification(notify_db,
notification_id = uuid.uuid4()
if provider_name is None:
provider_name = mmg_provider_name() if template.template_type == 'sms' else ses_provider_name()
if to_field:
to = to_field
else:
@@ -316,10 +322,12 @@ def sample_notification(notify_db,
'template': template,
'status': status,
'reference': reference,
'created_at': created_at
'created_at': created_at,
'content_char_count': content_char_count
}
notification = Notification(**data)
dao_create_notification(notification, template.template_type)
if create:
dao_create_notification(notification, template.template_type, provider_name)
return notification
@@ -431,3 +439,13 @@ def sample_service_permission(notify_db,
@pytest.fixture(scope='function')
def fake_uuid():
return "6ce466d0-fd6a-11e5-82f5-e0accb9d11a6"
@pytest.fixture(scope='function')
def ses_provider_name():
return 'ses'
@pytest.fixture(scope='function')
def mmg_provider_name():
return 'mmg'