Skip to content

Commit

Permalink
Merge PR #396 into 16.0
Browse files Browse the repository at this point in the history
Signed-off-by lmignon
  • Loading branch information
OCA-git-bot committed Dec 12, 2023
2 parents 1dbe80b + e4a14ed commit 945c756
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 3 deletions.
2 changes: 1 addition & 1 deletion fastapi/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Odoo FastAPI
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:7e852b9c3fc9194cdb6aec159a4d1b139ba10dc15b9aecd5158e0ffe1308a860
!! source digest: sha256:c1bd4722eaa873dcff3df33f91ca316004453aea2b43c9184928767f267edaaa
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png
Expand Down
9 changes: 9 additions & 0 deletions fastapi/readme/newsfragments/396.bugfix
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
When using the 'FastAPITransactionCase' class, allows to specify a specific
override of the 'authenticated_partner_impl' method into the list of
overrides to apply. Before this change, the 'authenticated_partner_impl'
override given in the 'overrides' parameter was always overridden in the
'_create_test_client' method of the 'FastAPITransactionCase' class. It's now
only overridden if the 'authenticated_partner_impl' method is not already
present in the list of overrides to apply and no specific partner is given.
If a specific partner is given at same time of an override for the
'authenticated_partner_impl' method, an error is raised.
2 changes: 1 addition & 1 deletion fastapi/static/description/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -367,7 +367,7 @@ <h1 class="title">Odoo FastAPI</h1>
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:7e852b9c3fc9194cdb6aec159a4d1b139ba10dc15b9aecd5158e0ffe1308a860
!! source digest: sha256:c1bd4722eaa873dcff3df33f91ca316004453aea2b43c9184928767f267edaaa
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
<p><a class="reference external image-reference" href="https://odoo-community.org/page/development-status"><img alt="Beta" src="https://img.shields.io/badge/maturity-Beta-yellow.png" /></a> <a class="reference external image-reference" href="http://www.gnu.org/licenses/lgpl-3.0-standalone.html"><img alt="License: LGPL-3" src="https://img.shields.io/badge/licence-LGPL--3-blue.png" /></a> <a class="reference external image-reference" href="https://github.com/OCA/rest-framework/tree/16.0/fastapi"><img alt="OCA/rest-framework" src="https://img.shields.io/badge/github-OCA%2Frest--framework-lightgray.png?logo=github" /></a> <a class="reference external image-reference" href="https://translation.odoo-community.org/projects/rest-framework-16-0/rest-framework-16-0-fastapi"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external image-reference" href="https://runboat.odoo-community.org/builds?repo=OCA/rest-framework&amp;target_branch=16.0"><img alt="Try me on Runboat" src="https://img.shields.io/badge/runboat-Try%20me-875A7B.png" /></a></p>
<p>This addon provides the basis to smoothly integrate the <a class="reference external" href="https://fastapi.tiangolo.com/">FastAPI</a>
Expand Down
8 changes: 7 additions & 1 deletion fastapi/tests/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,13 @@ def _create_test_client(
or self.default_fastapi_authenticated_partner
or self.env["res.partner"]
)
dependencies[authenticated_partner_impl] = partial(lambda a: a, partner)
if partner and authenticated_partner_impl in dependencies:
raise ValueError(
"You cannot provide an override for the authenticated_partner_impl "
"dependency when creating a test client with a partner."
)
if partner or authenticated_partner_impl not in dependencies:
dependencies[authenticated_partner_impl] = partial(lambda a: a, partner)
app = app or self.default_fastapi_app or FastAPI()
router = router or self.default_fastapi_router
if router:
Expand Down

0 comments on commit 945c756

Please sign in to comment.