|
13 | 13 | from pathlib import Path |
14 | 14 |
|
15 | 15 | import pytest |
| 16 | +from click import unstyle |
16 | 17 | from typer.testing import CliRunner |
17 | 18 |
|
18 | 19 | from mitreattack.attackToExcel import attackToExcel |
@@ -387,22 +388,25 @@ def test_attack_to_excel_cli_rejects_root_legacy_domain(attack_to_excel_runner: |
387 | 388 | def test_attack_to_excel_cli_help_lists_subcommands(attack_to_excel_runner: CliRunner): |
388 | 389 | """attack-to-excel help should expose the from-stix and from-release subcommands.""" |
389 | 390 | result = attack_to_excel_runner.invoke(attackToExcel.app, ["--help"]) |
| 391 | + root_help = unstyle(result.output) |
390 | 392 |
|
391 | 393 | assert result.exit_code == 0 |
392 | | - assert "from-stix" in result.output |
393 | | - assert "from-release" in result.output |
| 394 | + assert "from-stix" in root_help |
| 395 | + assert "from-release" in root_help |
394 | 396 |
|
395 | 397 | from_stix_help = attack_to_excel_runner.invoke(attackToExcel.app, ["from-stix", "--help"]) |
| 398 | + from_stix_output = unstyle(from_stix_help.output) |
396 | 399 | assert from_stix_help.exit_code == 0 |
397 | | - assert "--domain" in from_stix_help.output |
398 | | - assert "--remote" in from_stix_help.output |
399 | | - assert "--stix-file" in from_stix_help.output |
| 400 | + assert "--domain" in from_stix_output |
| 401 | + assert "--remote" in from_stix_output |
| 402 | + assert "--stix-file" in from_stix_output |
400 | 403 |
|
401 | 404 | from_release_help = attack_to_excel_runner.invoke(attackToExcel.app, ["from-release", "--help"]) |
| 405 | + from_release_output = unstyle(from_release_help.output) |
402 | 406 | assert from_release_help.exit_code == 0 |
403 | | - assert "--domains" in from_release_help.output |
404 | | - assert "--stix-version" in from_release_help.output |
405 | | - assert "--stix-base-dir" in from_release_help.output |
| 407 | + assert "--domains" in from_release_output |
| 408 | + assert "--stix-version" in from_release_output |
| 409 | + assert "--stix-base-dir" in from_release_output |
406 | 410 |
|
407 | 411 |
|
408 | 412 | def test_attack_to_excel_cli_no_args_shows_help(attack_to_excel_runner: CliRunner): |
|
0 commit comments