Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ repos:
pytest>=7.0.0,
pytest-asyncio>=0.21.0,
pytest-mock>=3.10.0,
pwinput>=1.0.3,
]
exclude: ^(client/|src/workato_platform/client/)

Expand Down
2 changes: 0 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ dependencies = [
"python-dateutil>=2.8.0",
"typing-extensions>=4.0.0",
"packaging>=21.0",
"pwinput>=1.0.3",
"cbor2>=5.7.0",
"certifi>=2025.8.3",
"keyring>=25.6.0",
Expand Down Expand Up @@ -183,7 +182,6 @@ module = [
"dependency_injector.*",
"asyncclick.*",
"keyring.*",
"pwinput.*",
]
ignore_missing_imports = true

Expand Down
13 changes: 1 addition & 12 deletions src/workato_platform_cli/cli/utils/config/manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
import asyncclick as click
import certifi
import inquirer
import pwinput

from workato_platform_cli import Workato
from workato_platform_cli.cli.commands.projects.project_manager import ProjectManager
Expand Down Expand Up @@ -339,18 +338,8 @@ async def _create_new_profile(self, profile_name: str) -> None:
)

# Get API token
# Note: pwinput.pwinput() is called synchronously (not wrapped in
# asyncio.to_thread) because wrapping it causes terminal buffer issues
# when pasting long tokens. The async wrapper interferes with terminal
# input buffering, causing some characters to leak through before masking.
# Since this is a blocking user input operation anyway, there's no benefit
# to making it async.
#
# TODO: Once we upgrade to Python 3.14+, consider migrating to the built-in
# getpass.getpass(prompt="...", echo_char='*') which provides native masked
# input support without requiring the pwinput dependency.
click.echo("🔐 Enter your API token")
token = pwinput.pwinput(prompt="Enter your Workato API token: ", mask="*")
token = await click.prompt("Enter your Workato API token", hide_input=True)
if not token.strip():
click.echo("❌ No token provided")
sys.exit(1)
Expand Down
33 changes: 8 additions & 25 deletions tests/unit/config/test_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -1220,6 +1220,7 @@ async def test_setup_profile_and_project_new_flow(

prompt_answers = {
"Enter profile name": ["dev"],
"Enter your Workato API token": ["token-123"],
"Enter project name": ["DemoProject"],
}

Expand All @@ -1232,16 +1233,6 @@ async def fake_prompt(message: str, **_: object) -> str:
ConfigManager.__module__ + ".click.prompt",
fake_prompt,
)

# Mock pwinput for token input
def fake_pwinput(prompt: str, mask: str = "*") -> str:
assert "API token" in prompt
return "token-123"

monkeypatch.setattr(
ConfigManager.__module__ + ".pwinput.pwinput",
fake_pwinput,
)
monkeypatch.setattr(
ConfigManager.__module__ + ".click.confirm",
lambda *a, **k: True,
Expand Down Expand Up @@ -1423,6 +1414,7 @@ async def test_create_new_profile_custom_region(

prompt_answers = {
"Enter your custom Workato base URL": ["https://custom.workato.test"],
"Enter your Workato API token": ["custom-token"],
}

async def fake_prompt(message: str, **_: Any) -> str:
Expand All @@ -1435,16 +1427,6 @@ async def fake_prompt(message: str, **_: Any) -> str:
fake_prompt,
)

# Mock pwinput for token input
def fake_pwinput(prompt: str, mask: str = "*") -> str:
assert "API token" in prompt
return "custom-token"

monkeypatch.setattr(
ConfigManager.__module__ + ".pwinput.pwinput",
fake_pwinput,
)

def custom_region_prompt(questions: list[Any]) -> dict[str, str]:
assert questions[0].message == "Select your Workato region"
return {"region": "Custom URL"}
Expand Down Expand Up @@ -1504,13 +1486,14 @@ async def test_create_new_profile_requires_token(
lambda _questions: {"region": "US Data Center (https://www.workato.com)"},
)

# Mock pwinput to return blank token
def fake_pwinput(prompt: str, mask: str = "*") -> str:
return " "
async def fake_prompt(message: str, **_: Any) -> str:
if "API token" in message:
return " "
return "unused"

monkeypatch.setattr(
ConfigManager.__module__ + ".pwinput.pwinput",
fake_pwinput,
ConfigManager.__module__ + ".click.prompt",
fake_prompt,
)

with pytest.raises(SystemExit):
Expand Down
8 changes: 0 additions & 8 deletions uv.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.