mirror of
https://github.com/unshackle-dl/unshackle.git
synced 2026-11-24 09:55:12 +00:00
test(serve): strip ANSI from CLI output before asserting error message
This commit is contained in:
@@ -2,6 +2,8 @@
|
|||||||
|
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
|
import re
|
||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
from click.testing import CliRunner
|
from click.testing import CliRunner
|
||||||
|
|
||||||
@@ -50,7 +52,9 @@ def test_serve_api_only_with_no_widevine_rejected(runner: CliRunner, monkeypatch
|
|||||||
|
|
||||||
result = runner.invoke(serve, ["--api-only", "--no-widevine", "--no-key"])
|
result = runner.invoke(serve, ["--api-only", "--no-widevine", "--no-key"])
|
||||||
assert result.exit_code != 0
|
assert result.exit_code != 0
|
||||||
assert "Cannot use --api-only" in (result.output or str(result.exception))
|
# strip ANSI: rich-click forces color under GITHUB_ACTIONS and styles --flags mid-sentence
|
||||||
|
output = re.sub(r"\x1b\[[0-9;]*m", "", result.output or str(result.exception))
|
||||||
|
assert "Cannot use --api-only" in output
|
||||||
|
|
||||||
|
|
||||||
def test_serve_no_key_without_api_secret_does_not_require_secret(
|
def test_serve_no_key_without_api_secret_does_not_require_secret(
|
||||||
|
|||||||
Reference in New Issue
Block a user