diff --git a/features/steps/project_cli_commands_steps.py b/features/steps/project_cli_commands_steps.py index b5462d647..40a088f20 100644 --- a/features/steps/project_cli_commands_steps.py +++ b/features/steps/project_cli_commands_steps.py @@ -673,10 +673,19 @@ def step_invoke_switch_fmt(context: Any, name: str, fmt: str) -> None: @when('I invoke project-switch for "{name}" without yes') def step_invoke_switch_no_confirm(context: Any, name: str) -> None: - """Invoke switch with --yes to accept the confirmation programmatically.""" - from cleveragents.cli.commands.project import switch + """Invoke switch without --yes, denying the confirmation prompt.""" + from typer.testing import CliRunner - _capture(context, switch, project=name, yes=True) + from cleveragents.cli.commands.project import app as project_app + + _patch_project_mod(context) + try: + cli_runner = CliRunner() + result = cli_runner.invoke(project_app, ["switch", name], input="n\n") + context._cmd_output = result.output + context._cmd_failed = result.exit_code != 0 + finally: + _unpatch_project_mod() @when('I invoke project-switch for "{name}" with yes and short flag') diff --git a/src/cleveragents/cli/commands/project.py b/src/cleveragents/cli/commands/project.py index aea8991ce..b8c6f7418 100644 --- a/src/cleveragents/cli/commands/project.py +++ b/src/cleveragents/cli/commands/project.py @@ -1049,7 +1049,10 @@ def switch( if not yes: if current_active: - confirm_msg = f"Switch active project from '{current_active}' to '{proj.namespaced_name}'?" + confirm_msg = ( + f"Switch active project from '{current_active}'" + f" to '{proj.namespaced_name}'?" + ) else: confirm_msg = f"Set active project to '{proj.namespaced_name}'?" confirm = typer.confirm(confirm_msg)