add tests for new statistics and fact notification status functions

This commit is contained in:
Leo Hemsted
2018-06-29 16:40:24 +01:00
parent 75fdb0290f
commit 089056ef72
6 changed files with 200 additions and 7 deletions

View File

@@ -35,6 +35,7 @@ from app.models import (
LetterRate,
InvitedOrganisationUser,
FactBilling,
FactNotificationStatus,
Complaint
)
from app.dao.users_dao import save_model_user
@@ -565,6 +566,36 @@ def create_ft_billing(bst_date,
return data
def create_ft_notification_status(
bst_date,
notification_type,
service=None,
template=None,
job=None,
key_type='normal',
notification_status='delivered',
count=1
):
if not service:
service = create_service()
if not template:
template = create_template(service=service, template_type=notification_type)
data = FactNotificationStatus(
bst_date=bst_date,
template_id=template.id,
service_id=service.id,
job_id=job.id if job else uuid.UUID(int=0),
notification_type=notification_type,
key_type=key_type,
notification_status=notification_status,
notification_count=count
)
db.session.add(data)
db.session.commit()
return data
def create_complaint(service=None,
notification=None,
created_at=None):