mirror of
https://github.com/GSA/notifications-api.git
synced 2026-02-02 17:31:14 -05:00
Query ft_billing aggregate for a month
This commit is contained in:
24
tests/app/dao/test_ft_billing_dao.py
Normal file
24
tests/app/dao/test_ft_billing_dao.py
Normal file
@@ -0,0 +1,24 @@
|
||||
from datetime import datetime
|
||||
from decimal import Decimal
|
||||
|
||||
from app.dao.fact_billing_dao import fetch_annual_billing_by_month
|
||||
from tests.app.db import create_ft_billing, create_service, create_template
|
||||
|
||||
|
||||
def test_fetch_annual_billing_by_month(notify_db_session):
|
||||
service = create_service()
|
||||
template = create_template(service=service, template_type="email")
|
||||
for i in range(1, 32):
|
||||
record = create_ft_billing(bst_date='2018-01-{}'.format(i),
|
||||
service=service,
|
||||
template=template,
|
||||
notification_type='email')
|
||||
|
||||
results, month = fetch_annual_billing_by_month(service_id=record.service_id,
|
||||
billing_month=datetime(2018, 1, 1),
|
||||
notification_type='email')
|
||||
|
||||
assert len(results) == 1
|
||||
assert results[0] == (31, Decimal('31'), service.id, 'email', Decimal('0'), Decimal('1'), False)
|
||||
assert month == datetime(2018, 1, 1)
|
||||
|
||||
Reference in New Issue
Block a user