Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FIX] fastapi: allow test with no authenticated partner #373

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions fastapi/tests/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,9 +93,12 @@ def _create_test_client(
dependencies.update(dependency_overrides)
if user:
env = env(user=user)
partner = partner or self.default_fastapi_authenticated_partner
if partner:
dependencies[authenticated_partner_impl] = partial(lambda a: a, 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
Loading