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

Function TestIsPermissionErrorStr

pkg/cli/audit_test.go:92–128  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

90}
91
92func TestIsPermissionErrorStr(t *testing.T) {
93 tests := []struct {
94 name string
95 s string
96 expected bool
97 }{
98 {
99 name: "Combined message with exit status 4",
100 s: "exit status 4 not logged into any GitHub hosts",
101 expected: true,
102 },
103 {
104 name: "Output only contains gh auth login",
105 s: "Run gh auth login to proceed",
106 expected: true,
107 },
108 {
109 name: "Empty string",
110 s: "",
111 expected: false,
112 },
113 {
114 name: "Unrelated combined message",
115 s: "exit status 1 unknown field",
116 expected: false,
117 },
118 }
119
120 for _, tt := range tests {
121 t.Run(tt.name, func(t *testing.T) {
122 result := isPermissionErrorStr(tt.s)
123 if result != tt.expected {
124 t.Errorf("Expected %v, got %v", tt.expected, result)
125 }
126 })
127 }
128}
129
130func TestBuildAuditData(t *testing.T) {
131 // Create test data

Callers

nothing calls this directly

Calls 3

isPermissionErrorStrFunction · 0.85
RunMethod · 0.45
ErrorfMethod · 0.45

Tested by

no test coverage detected