mirror of
https://github.com/kuhyx/utils.git
synced 2026-11-20 23:32:29 +01:00
Todo: 3a5477b9 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
26 lines
786 B
Python
26 lines
786 B
Python
import subprocess
|
|
from pathlib import Path
|
|
|
|
import pytest
|
|
|
|
from kuhy_credit import TEXT, URL, credit_line, terminal
|
|
|
|
CREDIT_DIR = Path(__file__).resolve().parents[1]
|
|
|
|
|
|
def test_credit_line_is_text_then_url() -> None:
|
|
assert credit_line() == "Created by kuhy https://kuhy.duckdns.org"
|
|
assert (TEXT, URL) == ("Created by kuhy", "https://kuhy.duckdns.org")
|
|
|
|
|
|
def test_main_prints_one_line(capsys: pytest.CaptureFixture[str]) -> None:
|
|
assert terminal.main() == 0
|
|
assert capsys.readouterr().out == "Created by kuhy https://kuhy.duckdns.org\n"
|
|
|
|
|
|
def test_shell_helper_prints_the_same_line() -> None:
|
|
out = subprocess.run(
|
|
[str(CREDIT_DIR / "terminal/kuhy-credit.sh")], check=True, capture_output=True, text=True
|
|
).stdout
|
|
assert out == credit_line() + "\n"
|