Coverage for tests / unit / cli_utils / command_chainer / test_integration.py: 100%
20 statements
« prev ^ index » next coverage.py v7.13.0, created at 2026-04-03 18:53 +0000
« prev ^ index » next coverage.py v7.13.0, created at 2026-04-03 18:53 +0000
1"""Integration tests for CommandChainer full workflow."""
3from __future__ import annotations
5import click
6from assertpy import assert_that
8from lintro.cli_utils.command_chainer import CommandChainer
11def test_full_workflow_parse_and_group(mock_group: click.Group) -> None:
12 """Test complete workflow from raw args to command groups.
14 Args:
15 mock_group: Mocked Click group fixture.
16 """
17 chainer = CommandChainer(mock_group)
19 raw_args = ["fmt", ".", ",", "chk", ".", ",", "tst"]
21 assert_that(chainer.should_chain(raw_args)).is_true()
23 normalized = chainer.normalize_args(raw_args)
24 assert_that(normalized).is_equal_to(raw_args)
26 groups = chainer.group_commands(normalized)
27 assert_that(groups).is_equal_to([["fmt", "."], ["chk", "."], ["tst"]])
30def test_full_workflow_joined_commands(mock_group: click.Group) -> None:
31 """Test workflow with joined commands like fmt,chk.
33 Args:
34 mock_group: Mocked Click group fixture.
35 """
36 chainer = CommandChainer(mock_group)
38 raw_args = ["fmt,chk", "."]
40 assert_that(chainer.should_chain(raw_args)).is_true()
42 normalized = chainer.normalize_args(raw_args)
43 assert_that(normalized).is_equal_to(["fmt", ",", "chk", "."])
45 groups = chainer.group_commands(normalized)
46 assert_that(groups).is_equal_to([["fmt"], ["chk", "."]])