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

Function TestGitHubLockdownField

pkg/workflow/github_lockdown_test.go:10–64  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

8)
9
10func TestGitHubLockdownField(t *testing.T) {
11 tests := []struct {
12 name string
13 toolsMap map[string]any
14 expected bool
15 }{
16 {
17 name: "lockdown explicitly enabled",
18 toolsMap: map[string]any{
19 "github": map[string]any{
20 "lockdown": true,
21 },
22 },
23 expected: true,
24 },
25 {
26 name: "lockdown explicitly disabled",
27 toolsMap: map[string]any{
28 "github": map[string]any{
29 "lockdown": false,
30 },
31 },
32 expected: false,
33 },
34 {
35 name: "lockdown not specified (default false)",
36 toolsMap: map[string]any{
37 "github": map[string]any{
38 "mode": "local",
39 },
40 },
41 expected: false,
42 },
43 {
44 name: "empty github config (default false)",
45 toolsMap: map[string]any{"github": map[string]any{}},
46 expected: false,
47 },
48 {
49 name: "nil github config (default false)",
50 toolsMap: map[string]any{"github": nil},
51 expected: false,
52 },
53 }
54
55 for _, tt := range tests {
56 t.Run(tt.name, func(t *testing.T) {
57 githubTool, _ := tt.toolsMap["github"].(map[string]any)
58 result := getGitHubLockdown(githubTool)
59 if result != tt.expected {
60 t.Errorf("getGitHubLockdown() = %v, want %v", result, tt.expected)
61 }
62 })
63 }
64}
65
66func TestGitHubToolConfigLockdownParsing(t *testing.T) {
67 tests := []struct {

Callers

nothing calls this directly

Calls 3

getGitHubLockdownFunction · 0.85
RunMethod · 0.45
ErrorfMethod · 0.45

Tested by

no test coverage detected