vincbeck commented on code in PR #77585:
URL: https://github.com/apache/airflow/pull/77585#discussion_r4699986976
##########
providers/keycloak/src/airflow/providers/keycloak/auth_manager/cli/commands.py:
##########
@@ -1132,6 +1175,10 @@ def _ensure_role_policy(
if _get_policy_id(client, client_uuid, policy_name, policy_type="role"):
return
+ if _dry_run:
Review Comment:
This fixes `create-all --dry-run` but `create-permissions --dry-run` on a
fresh realm now prints "Would create role policy ..." for every role, and then
the real run fails with the same bare "role not found" error, since
`create-permissions` does not create the roles. Should `_get_role_id` catch the
`KeycloakGetError` and tell the user to run `create-roles` first?
##########
providers/keycloak/tests/unit/keycloak/auth_manager/cli/test_commands.py:
##########
@@ -950,6 +991,49 @@ def test_create_resources_dry_run(self, mock_get_client):
# In dry-run mode, no resources should be created
client.create_client_authz_resource.assert_not_called()
+ @patch("airflow.providers.keycloak.auth_manager.cli.commands._get_client")
+ def test_create_roles_dry_run(self, mock_get_client):
Review Comment:
nit: this test and `test_create_roles` run the same command with different
inputs, could you merge them into one parametrized test?
--
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]