Skip to content

Commit fa1d183

Browse files
committed
feat: upgrade remote scanning and reporting (tests/test_cli.py)
1 parent 3385143 commit fa1d183

1 file changed

Lines changed: 39 additions & 0 deletions

File tree

tests/test_cli.py

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
"""Tests for CLI helpers."""
2+
3+
import pytest
4+
5+
from roast.cli import _parse_github_target, _should_fail_quality_gate, _validate_fail_under
6+
7+
8+
def test_parse_github_target_supports_repo_root() -> None:
9+
assert _parse_github_target("https://github.com/octocat/hello-world") == (
10+
"octocat",
11+
"hello-world",
12+
None,
13+
)
14+
15+
16+
def test_parse_github_target_supports_tree_ref() -> None:
17+
assert _parse_github_target("https://github.com/octocat/hello-world/tree/feature/demo") == (
18+
"octocat",
19+
"hello-world",
20+
"feature/demo",
21+
)
22+
23+
24+
def test_parse_github_target_rejects_non_repo_paths() -> None:
25+
with pytest.raises(RuntimeError):
26+
_parse_github_target("https://github.com/octocat/hello-world/issues/1")
27+
28+
29+
def test_validate_fail_under_requires_score_range() -> None:
30+
assert _validate_fail_under(0) == 0
31+
assert _validate_fail_under(100) == 100
32+
with pytest.raises(RuntimeError):
33+
_validate_fail_under(101)
34+
35+
36+
def test_should_fail_quality_gate_only_when_below_threshold() -> None:
37+
assert not _should_fail_quality_gate(70, None)
38+
assert not _should_fail_quality_gate(70, 70)
39+
assert _should_fail_quality_gate(69, 70)

0 commit comments

Comments
 (0)