mirror of
https://github.com/GSA/notifications-api.git
synced 2025-12-24 01:11:38 -05:00
Removed an update statement to notifications.
It's a small change, but we should remove any db operations that are not necessary.
This commit is contained in:
@@ -40,3 +40,18 @@ def test_create_letter_notification_sets_reference(sample_letter_template, sampl
|
||||
notification = create_letter_notification(data, sample_letter_template, sample_api_key, NOTIFICATION_CREATED)
|
||||
|
||||
assert notification.client_reference == 'foo'
|
||||
|
||||
|
||||
def test_create_letter_notification_sets_billable_units(sample_letter_template, sample_api_key):
|
||||
data = {
|
||||
'personalisation': {
|
||||
'address_line_1': 'The Queen',
|
||||
'address_line_2': 'Buckingham Palace',
|
||||
'postcode': 'SW1 1AA',
|
||||
},
|
||||
}
|
||||
|
||||
notification = create_letter_notification(data, sample_letter_template, sample_api_key, NOTIFICATION_CREATED,
|
||||
billable_units=3)
|
||||
|
||||
assert notification.billable_units == 3
|
||||
|
||||
@@ -500,3 +500,22 @@ def test_persist_notification_increments_and_expires_redis_template_usage(
|
||||
'service-{}-template-usage-{}'.format(str(sample_template.service_id), day_in_key),
|
||||
current_app.config['EXPIRE_CACHE_EIGHT_DAYS']
|
||||
)
|
||||
|
||||
|
||||
def test_persist_notification_with_billable_units_stores_correct_info(
|
||||
sample_template,
|
||||
):
|
||||
persist_notification(
|
||||
template_id=sample_template.id,
|
||||
template_version=sample_template.version,
|
||||
recipient="123 Main Street",
|
||||
service=sample_template.service,
|
||||
personalisation=None,
|
||||
notification_type='letter',
|
||||
api_key_id=None,
|
||||
key_type="normal",
|
||||
billable_units=3
|
||||
)
|
||||
persisted_notification = Notification.query.all()[0]
|
||||
|
||||
assert persisted_notification.billable_units == 3
|
||||
|
||||
Reference in New Issue
Block a user