billing: Add randomness to idempotency key while testing.

Makes it easier to test or regenerate fixtures for
test_billing_quantity_changes_end_to_end with generate=True.
This commit is contained in:
Rishi Gupta
2018-11-30 22:12:35 -08:00
parent 18e2118fc8
commit c9c842ae2b
2 changed files with 4 additions and 1 deletions

View File

@@ -356,6 +356,8 @@ def process_billing_log_entry(processor: BillingProcessor, log_row: RealmAuditLo
customer = Customer.objects.get(realm=log_row.realm)
timestamp = datetime_to_timestamp(log_row.event_time)
idempotency_key = 'process_billing_log_entry:%s' % (log_row.id,)
if settings.TEST_SUITE:
idempotency_key += '+' + generate_random_token(10)
extra_args = {} # type: Dict[str, Any]
if log_row.extra_data is not None:
extra_args = ujson.loads(log_row.extra_data)