mirror of
https://github.com/GSA/notifications-api.git
synced 2026-02-03 18:01:08 -05:00
New strategy for transaction management.
Introduce a contextmanger function to handle exceptions and nested transactions. Using the nested_transaction will start a nested transaction with `db.session.begin_nested`, once the nested transaction is complete the commit will happen. `@transactional` has been updated to commit unless in a nested transaction.
This commit is contained in:
@@ -233,7 +233,7 @@ def test_add_service_to_organisation(sample_service, sample_organisation):
|
||||
sample_organisation.crown = False
|
||||
|
||||
dao_add_service_to_organisation(sample_service, sample_organisation.id)
|
||||
db.session.commit()
|
||||
|
||||
assert len(sample_organisation.services) == 1
|
||||
assert sample_organisation.services[0].id == sample_service.id
|
||||
|
||||
|
||||
Reference in New Issue
Block a user