mirror of
https://github.com/GSA/notifications-api.git
synced 2025-12-24 01:11:38 -05:00
Write some pseudo code for ft billing
This commit is contained in:
@@ -1,8 +1,11 @@
|
||||
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
|
||||
from freezegun import freeze_time
|
||||
|
||||
from app.dao.date_util import get_month_start_and_end_date_in_utc
|
||||
from app.dao.fact_billing_dao import fetch_annual_billing_by_month, need_deltas
|
||||
from tests.app.db import create_ft_billing, create_service, create_template, create_notification
|
||||
|
||||
|
||||
def test_fetch_annual_billing_by_month(notify_db_session):
|
||||
@@ -22,3 +25,18 @@ def test_fetch_annual_billing_by_month(notify_db_session):
|
||||
assert results[0] == (31, Decimal('31'), service.id, 'email', Decimal('0'), Decimal('1'), False)
|
||||
assert month == datetime(2018, 1, 1)
|
||||
|
||||
|
||||
@freeze_time("2018-01-21 13:00:00")
|
||||
def test_need_deltas(notify_db_session):
|
||||
service = create_service()
|
||||
template = create_template(service=service, template_type="email")
|
||||
for i in range(1, 21):
|
||||
record = create_ft_billing(bst_date='2018-01-{}'.format(i),
|
||||
service=service,
|
||||
template=template,
|
||||
notification_type='email')
|
||||
start_date, end_date = get_month_start_and_end_date_in_utc(datetime.utcnow())
|
||||
|
||||
result = need_deltas(start_date=start_date, end_date=end_date,
|
||||
service_id=service.id, notification_type='email')
|
||||
assert result
|
||||
|
||||
Reference in New Issue
Block a user