transaction: Add 'savepoint=True' explicitly in tests, if used.

We create savepoint at a couple of places in backend tests
to avoid rollback due to error raised within test's transaction.

This commit explicitly adds 'savepoint=True' at those places.
This commit is contained in:
Prakhar Pratyush
2024-11-22 00:25:41 +05:30
committed by Tim Abbott
parent fdcd518e26
commit 62b3e49075
2 changed files with 3 additions and 3 deletions

View File

@@ -1462,10 +1462,10 @@ Output:
"invite_only": orjson.dumps(invite_only).decode(),
}
post_data.update(extra_post_data)
# We wrap the API call with a 'transaction.atomic()' context
# We wrap the API call with a 'transaction.atomic' context
# manager as it helps us with NOT rolling back the entire
# test transaction due to error responses.
with transaction.atomic():
with transaction.atomic(savepoint=True):
result = self.api_post(
user,
"/api/v1/users/me/subscriptions",