-
-
Notifications
You must be signed in to change notification settings - Fork 304
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
[FIX] fastapi: allow test with no authenticated partner #373
Conversation
Hi @lmignon, |
7c070c7
to
2830a94
Compare
LGTM (code review), @lmignon ok for you ? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The only change to do is:
partner = partner or self.default_fastapi_authenticated_partner or self.env["res.partner"]
dependencies[authenticated_partner_impl] = partial(lambda a: a, partner)
ping @matthieusaison |
Thanks @lmignon for your feedback, the change is made. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code review
/ocabot merge patch |
On my way to merge this fine PR! |
Congratulations, your PR was merged at 4289428. Thanks a lot for contributing to OCA. ❤️ |
In case you need an anonymous call in your test.
The /fastapi/tests/common.py _create_test_client() function fails due to an empty authenticated_partner_impl.
This proposal allows you to define an empty partner for your test:
cls.default_fastapi_authenticated_partner = cls.env["res.partner"]
An authenticated test can be done like this:
self._create_test_client(partner=self.test_partner)