MCPcopy Create free account
hub / github.com/github/gh-aw / TestParseAndDisplayRunnerGuardOutput

Function TestParseAndDisplayRunnerGuardOutput

pkg/cli/runner_guard_test.go:12–288  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

10)
11
12func TestParseAndDisplayRunnerGuardOutput(t *testing.T) {
13 tests := []struct {
14 name string
15 stdout string
16 verbose bool
17 expectedOutput []string
18 expectError bool
19 expectedCount int
20 }{
21 {
22 name: "single high severity finding",
23 stdout: `{
24 "findings": [
25 {
26 "rule_id": "RGS-001",
27 "name": "Unsafe Runner Usage",
28 "severity": "high",
29 "description": "Runner pulls from untrusted source",
30 "remediation": "Pin runner image digest",
31 "file": ".github/workflows/test.lock.yml",
32 "line": 15
33 }
34 ]
35}`,
36 expectedOutput: []string{
37 ".github/workflows/test.lock.yml:15:1",
38 "error",
39 "RGS-001",
40 "Unsafe Runner Usage",
41 "Runner pulls from untrusted source",
42 },
43 expectError: false,
44 expectedCount: 1,
45 },
46 {
47 name: "critical severity maps to error type",
48 stdout: `{
49 "findings": [
50 {
51 "rule_id": "RGS-002",
52 "name": "Critical Finding",
53 "severity": "critical",
54 "description": "Dangerous configuration",
55 "file": ".github/workflows/test.lock.yml",
56 "line": 10
57 }
58 ]
59}`,
60 expectedOutput: []string{
61 "error",
62 "RGS-002",
63 "Critical Finding",
64 },
65 expectError: false,
66 expectedCount: 1,
67 },
68 {
69 name: "note severity maps to info type",

Callers

nothing calls this directly

Calls 5

CloseMethod · 0.65
RunMethod · 0.45
StringMethod · 0.45
ErrorfMethod · 0.45

Tested by

no test coverage detected