Skip to content

Commit

Permalink
review change
Browse files Browse the repository at this point in the history
  • Loading branch information
matthieu.saison committed Sep 25, 2023
1 parent 2830a94 commit aba642f
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions fastapi/tests/common.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# Copyright 2023 ACSONE SA/NV
# License LGPL-3.0 or later (http://www.gnu.org/licenses/LGPL).
from contextlib import contextmanager
from functools import partial
from typing import Any, Callable, Dict

from odoo.api import Environment
Expand Down Expand Up @@ -92,8 +93,12 @@ def _create_test_client(
dependencies.update(dependency_overrides)
if user:
env = env(user=user)
partner = partner or self.default_fastapi_authenticated_partner
dependencies[authenticated_partner_impl] = lambda: partner
partner = (
partner
or self.default_fastapi_authenticated_partner
or self.env["res.partner"]
)
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 aba642f

Please sign in to comment.