Files
falyx/tests/test_actions/test_confirm_action.py
Roland Thomas fa5e2a4c2c feat: add TLDR ArgumentAction and Rich-compatible prompt styling
- Introduce `ArgumentAction.TLDR` for showing concise usage examples
- Add `rich_text_to_prompt_text()` to support Rich-style markup in all prompt_toolkit inputs
- Migrate all prompt-based Actions to use `prompt_message` with Rich styling support
- Standardize `CancelSignal` as the default interrupt behavior for prompt-driven Actions
2025-07-22 21:56:44 -04:00

95 lines
2.0 KiB
Python

import pytest
from falyx.action import ConfirmAction
@pytest.mark.asyncio
async def test_confirm_action_yes_no():
action = ConfirmAction(
name="test",
prompt_message="Are you sure?",
never_prompt=True,
confirm_type="yes_no",
)
result = await action()
assert result is True
@pytest.mark.asyncio
async def test_confirm_action_yes_cancel():
action = ConfirmAction(
name="test",
prompt_message="Are you sure?",
never_prompt=True,
confirm_type="yes_cancel",
)
result = await action()
assert result is True
@pytest.mark.asyncio
async def test_confirm_action_yes_no_cancel():
action = ConfirmAction(
name="test",
prompt_message="Are you sure?",
never_prompt=True,
confirm_type="yes_no_cancel",
)
result = await action()
assert result is True
@pytest.mark.asyncio
async def test_confirm_action_type_word():
action = ConfirmAction(
name="test",
prompt_message="Are you sure?",
never_prompt=True,
confirm_type="type_word",
)
result = await action()
assert result is True
@pytest.mark.asyncio
async def test_confirm_action_type_word_cancel():
action = ConfirmAction(
name="test",
prompt_message="Are you sure?",
never_prompt=True,
confirm_type="type_word_cancel",
)
result = await action()
assert result is True
@pytest.mark.asyncio
async def test_confirm_action_ok_cancel():
action = ConfirmAction(
name="test",
prompt_message="Are you sure?",
never_prompt=True,
confirm_type="ok_cancel",
)
result = await action()
assert result is True
@pytest.mark.asyncio
async def test_confirm_action_acknowledge():
action = ConfirmAction(
name="test",
prompt_message="Are you sure?",
never_prompt=True,
confirm_type="acknowledge",
)
result = await action()
assert result is True