stegololz commented on code in PR #61351:
URL: https://github.com/apache/airflow/pull/61351#discussion_r2821930622
##########
providers/keycloak/tests/unit/keycloak/auth_manager/test_keycloak_auth_manager.py:
##########
@@ -411,12 +441,213 @@ def test_is_authorized_dag(
token_url = auth_manager._get_token_url("server_url", "realm")
payload = auth_manager._get_payload("client_id", permission,
attributes)
- headers = auth_manager._get_headers("access_token")
+ headers = auth_manager._get_headers(user.access_token)
auth_manager.http_session.post.assert_called_once_with(
token_url, data=payload, headers=headers, timeout=5
)
assert result == expected
+ @pytest.mark.parametrize(
+ ("function", "method", "details", "permission"),
+ [
+ ("is_authorized_dag", "GET", DagDetails(id="test",
team_name="team-a"), "Dag#GET"),
+ (
+ "is_authorized_connection",
+ "DELETE",
+ ConnectionDetails(conn_id="test", team_name="team-a"),
+ "Connection#DELETE",
+ ),
+ (
+ "is_authorized_variable",
+ "PUT",
+ VariableDetails(key="test", team_name="team-a"),
+ "Variable#PUT",
+ ),
+ ("is_authorized_pool", "POST", PoolDetails(name="test",
team_name="team-a"), "Pool#POST"),
+ ]
+ if AIRFLOW_V_3_2_PLUS
+ else [],
Review Comment:
Done.
This change added a little twist. As resource detail classes gained the
team_name kwarg in a recent version, constructing them directly would raise
TypeError on older versions. Deferring construction to the test body via
details_cls/details_kwargs lets skipif prevent execution first.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]