Conversation
9a9c865 to
2afcbb3
Compare
| res = super()._setup_records() | ||
| cls.url = "https://localhost.demo.odoo/" | ||
| # Certificate and private key configuration | ||
| os.environ["SERVER_ENV_CONFIG"] = "\n".join( |
There was a problem hiding this comment.
this is the right way to mock env vars https://github.com/OCA/server-env/blob/18.0/server_environment/tests/test_server_environment.py#L59
There was a problem hiding this comment.
tests are updated to use load_config(): https://github.com/OCA/server-env/blob/18.0/server_environment/tests/common.py#L42-L63
| self.assertEqual(kwargs["cert"], ("/path/client.cert", "/path/client.key")) | ||
|
|
||
| def test_request_adapter_certificate_only(self): | ||
| with mock.patch("requests.request") as mock_request: |
There was a problem hiding this comment.
why not using responses lib? https://github.com/OCA/web-api/blob/18.0/webservice/tests/test_webservice.py#L82
There was a problem hiding this comment.
IIRC, I couldn't retrieve the request's kwargs using responses
0ab4d43 to
42cc48d
Compare
|
There hasn't been any activity on this pull request in the past 4 months, so it has been marked as stale and it will be closed automatically if no further activity occurs in the next 30 days. |
|
This PR has the |
| for auth_type, oauth2_flow in [ | ||
| (tp, fl) | ||
| for tp in ws._fields["auth_type"].get_values(ws.env) | ||
| for tp in ["none", "user_pwd", "api_key", "oauth2"] |
There was a problem hiding this comment.
Can you add a small comment to explain why these values are hardcoded?
There was a problem hiding this comment.
Thankfully I wrote it in the commit message, because I didn't remember why I hardcoded the values 😅
The test `test_oauth2_flow_compute_with_ui` iterates over all available `auth_type` values.
When a module extends `webservice` with an additional `auth_type` (e.g., `client_certificate`),
this test fails because it does not know how to populate the new required fields for that type.
This commit restricts the test loop to the authentication types defined in `webservice` module.
Comment is added
The test `test_oauth2_flow_compute_with_ui` iterates over all available `auth_type` values. When a module extends `webservice` with an additional `auth_type` (e.g., `client_certificate`), this test fails because it does not know how to populate the new required fields for that type. This commit restricts the test loop to the authentication types defined in `webservice` module.
Server environment support is optional in webservice since webservice_server_env was split out. Keep the client certificate server env fields in a glue module so that webservice_client_certificate_auth does not force server_environment.
6a55b11 to
4591dea
Compare
No description provided.