mirror of
https://github.com/GSA/notifications-api.git
synced 2026-01-31 23:26:23 -05:00
Changed the update/insert to a postgres upsert to avoid concurrency issues.
This commit is contained in:
@@ -438,7 +438,22 @@ def test_create_nightly_billing_update_when_record_exists(
|
||||
|
||||
assert len(records) == 1
|
||||
assert records[0].bst_date == date(2018, 1, 14)
|
||||
assert records[0].billable_units == 1
|
||||
|
||||
sample_notification(
|
||||
notify_db,
|
||||
notify_db_session,
|
||||
created_at=datetime.now() - timedelta(days=1),
|
||||
service=sample_service,
|
||||
template=sample_template,
|
||||
status='delivered',
|
||||
sent_by=None,
|
||||
international=False,
|
||||
rate_multiplier=1.0,
|
||||
billable_units=1,
|
||||
)
|
||||
|
||||
# run again, make sure create_nightly_billing() updates with no error
|
||||
create_nightly_billing()
|
||||
assert len(records) == 1
|
||||
assert records[0].billable_units == 2
|
||||
|
||||
Reference in New Issue
Block a user