remove notification_type and service from create_ft_billing

they can both be inferred from the template, and specifying them just
leads to unnecessary risk of errors
This commit is contained in:
Leo Hemsted
2019-12-03 17:02:58 +00:00
parent ed5a52fe0d
commit dd57468147
7 changed files with 62 additions and 139 deletions

View File

@@ -187,20 +187,14 @@ def test_get_yearly_usage_by_monthly_from_ft_billing(client, notify_db_session):
for day in range(1, monthrange(2016, month)[1] + 1):
d = str(day).zfill(2)
create_ft_billing(bst_date='2016-{}-{}'.format(mon, d),
service=service,
template=sms_template,
notification_type='sms',
billable_unit=1,
rate=0.162)
create_ft_billing(bst_date='2016-{}-{}'.format(mon, d),
service=service,
template=email_template,
notification_type='email',
rate=0)
create_ft_billing(bst_date='2016-{}-{}'.format(mon, d),
service=service,
template=letter_template,
notification_type='letter',
billable_unit=1,
rate=0.33,
postage='second')
@@ -242,26 +236,18 @@ def set_up_yearly_data():
for day in range(1, monthrange(2016, month)[1] + 1):
d = str(day).zfill(2)
create_ft_billing(bst_date='2016-{}-{}'.format(mon, d),
service=service,
template=sms_template,
notification_type='sms',
rate=0.0162)
create_ft_billing(bst_date='2016-{}-{}'.format(mon, d),
service=service,
template=sms_template,
notification_type='sms',
rate_multiplier=2,
rate=0.0162)
create_ft_billing(bst_date='2016-{}-{}'.format(mon, d),
service=service,
template=email_template,
notification_type='email',
billable_unit=0,
rate=0)
create_ft_billing(bst_date='2016-{}-{}'.format(mon, d),
service=service,
template=letter_template,
notification_type='letter',
rate=0.33,
postage='second')
start_date, end_date = get_month_start_and_end_date_in_utc(datetime(2016, int(mon), 1))
@@ -397,45 +383,35 @@ def set_up_data_for_all_cases():
email_template = create_template(service=service, template_type="email")
letter_template = create_template(service=service, template_type="letter")
create_ft_billing(bst_date='2018-05-16',
notification_type='sms',
template=sms_template,
service=service,
rate_multiplier=1,
international=False,
rate=0.162,
billable_unit=1,
notifications_sent=1)
create_ft_billing(bst_date='2018-05-17',
notification_type='sms',
template=sms_template,
service=service,
rate_multiplier=2,
international=False,
rate=0.162,
billable_unit=2,
notifications_sent=1)
create_ft_billing(bst_date='2018-05-16',
notification_type='sms',
template=sms_template,
service=service,
rate_multiplier=2,
international=False,
rate=0.0150,
billable_unit=2,
notifications_sent=1)
create_ft_billing(bst_date='2018-05-16',
notification_type='email',
template=email_template,
service=service,
rate_multiplier=1,
international=False,
rate=0,
billable_unit=0,
notifications_sent=1)
create_ft_billing(bst_date='2018-05-16',
notification_type='letter',
template=letter_template,
service=service,
rate_multiplier=1,
international=False,
rate=0.33,
@@ -443,9 +419,7 @@ def set_up_data_for_all_cases():
notifications_sent=1,
postage='second')
create_ft_billing(bst_date='2018-05-17',
notification_type='letter',
template=letter_template,
service=service,
rate_multiplier=1,
international=False,
rate=0.36,
@@ -453,9 +427,7 @@ def set_up_data_for_all_cases():
notifications_sent=1,
postage='second')
create_ft_billing(bst_date='2018-05-18',
notification_type='letter',
template=letter_template,
service=service,
rate_multiplier=1,
international=False,
rate=0.39,