File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 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 )
You can’t perform that action at this time.
0 commit comments