Skip to content

Commit

Permalink
fixup! [FIX] fastapi: close cursor after rollback
Browse files Browse the repository at this point in the history
  • Loading branch information
lmignon committed Dec 21, 2023
1 parent 5c30af1 commit d85bf2a
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion fastapi/tests/test_fastapi_demo.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,9 @@ def assert_exception_processed(
demo_app._get_app(), raise_server_exceptions=False
) as test_client, mock.patch.object(
self.env.cr.__class__, "rollback"
) as mock_rollback:
) as mock_rollback, mock.patch.object(
self.env.cr.__class__, "close"
) as mock_close:
response: Response = test_client.get(
"/demo/exception",
params={
Expand All @@ -56,6 +58,7 @@ def assert_exception_processed(
},
)
mock_rollback.assert_called_once()
mock_close.assert_called_once()
self.assertEqual(response.status_code, expected_status_code)
self.assertDictEqual(
response.json(),
Expand Down

0 comments on commit d85bf2a

Please sign in to comment.