mirror of
https://github.com/GSA/notifications-api.git
synced 2026-08-11 09:27:56 -04:00
progress on removing postage
This commit is contained in:
@@ -289,116 +289,6 @@ def test_create_nightly_billing_for_day_different_sent_by(
|
||||
assert record.rate_multiplier == 1.0
|
||||
|
||||
|
||||
@pytest.mark.skip(reason="Needs updating for TTS: Remove mail")
|
||||
def test_create_nightly_billing_for_day_different_letter_postage(
|
||||
notify_db_session,
|
||||
sample_letter_template,
|
||||
mocker
|
||||
):
|
||||
yesterday = datetime.now() - timedelta(days=1)
|
||||
mocker.patch('app.dao.fact_billing_dao.get_rate', side_effect=mocker_get_rate)
|
||||
|
||||
for _ in range(2):
|
||||
create_notification(
|
||||
created_at=yesterday,
|
||||
template=sample_letter_template,
|
||||
status='delivered',
|
||||
sent_by='dvla',
|
||||
billable_units=2,
|
||||
postage='first'
|
||||
)
|
||||
create_notification(
|
||||
created_at=yesterday,
|
||||
template=sample_letter_template,
|
||||
status='delivered',
|
||||
sent_by='dvla',
|
||||
billable_units=2,
|
||||
postage='second'
|
||||
)
|
||||
create_notification(
|
||||
created_at=yesterday,
|
||||
template=sample_letter_template,
|
||||
status='delivered',
|
||||
sent_by='dvla',
|
||||
billable_units=1,
|
||||
postage='europe'
|
||||
)
|
||||
create_notification(
|
||||
created_at=yesterday,
|
||||
template=sample_letter_template,
|
||||
status='delivered',
|
||||
sent_by='dvla',
|
||||
billable_units=3,
|
||||
postage='rest-of-world'
|
||||
)
|
||||
|
||||
records = FactBilling.query.all()
|
||||
assert len(records) == 0
|
||||
create_nightly_billing_for_day(str(yesterday.date()))
|
||||
|
||||
records = FactBilling.query.order_by('postage').all()
|
||||
assert len(records) == 4
|
||||
|
||||
assert records[0].notification_type == LETTER_TYPE
|
||||
assert records[0].local_date == datetime.date(yesterday)
|
||||
assert records[0].postage == 'europe'
|
||||
assert records[0].notifications_sent == 1
|
||||
assert records[0].billable_units == 1
|
||||
|
||||
assert records[1].notification_type == LETTER_TYPE
|
||||
assert records[1].local_date == datetime.date(yesterday)
|
||||
assert records[1].postage == 'first'
|
||||
assert records[1].notifications_sent == 2
|
||||
assert records[1].billable_units == 4
|
||||
|
||||
assert records[2].notification_type == LETTER_TYPE
|
||||
assert records[2].local_date == datetime.date(yesterday)
|
||||
assert records[2].postage == 'rest-of-world'
|
||||
assert records[2].notifications_sent == 1
|
||||
assert records[2].billable_units == 3
|
||||
|
||||
assert records[3].notification_type == LETTER_TYPE
|
||||
assert records[3].local_date == datetime.date(yesterday)
|
||||
assert records[3].postage == 'second'
|
||||
assert records[3].notifications_sent == 1
|
||||
assert records[3].billable_units == 2
|
||||
|
||||
|
||||
@pytest.mark.skip(reason="Needs updating for TTS: Timezone handling")
|
||||
def test_create_nightly_billing_for_day_letter(
|
||||
sample_service,
|
||||
sample_letter_template,
|
||||
mocker
|
||||
):
|
||||
yesterday = datetime.now() - timedelta(days=1)
|
||||
|
||||
mocker.patch('app.dao.fact_billing_dao.get_rate', side_effect=mocker_get_rate)
|
||||
|
||||
create_notification(
|
||||
created_at=yesterday,
|
||||
template=sample_letter_template,
|
||||
status='delivered',
|
||||
sent_by='dvla',
|
||||
international=False,
|
||||
rate_multiplier=2.0,
|
||||
billable_units=2,
|
||||
)
|
||||
|
||||
records = FactBilling.query.all()
|
||||
assert len(records) == 0
|
||||
create_nightly_billing_for_day(str(yesterday.date()))
|
||||
|
||||
records = FactBilling.query.order_by('rate_multiplier').all()
|
||||
assert len(records) == 1
|
||||
|
||||
record = records[0]
|
||||
assert record.notification_type == LETTER_TYPE
|
||||
assert record.local_date == datetime.date(yesterday)
|
||||
assert record.rate == Decimal(2.1)
|
||||
assert record.billable_units == 2
|
||||
assert record.rate_multiplier == 2.0
|
||||
|
||||
|
||||
@pytest.mark.skip(reason="Needs updating for TTS: Timezone handling")
|
||||
def test_create_nightly_billing_for_day_null_sent_by_sms(
|
||||
sample_service,
|
||||
|
||||
Reference in New Issue
Block a user