MCPcopy Index your code
hub / github.com/devopsctl/gitlabctl / TestGetProjectHooks

Function TestGetProjectHooks

cmd/get_project_hooks_test.go:29–71  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

27)
28
29func TestGetProjectHooks(t *testing.T) {
30 tt := []struct {
31 name string
32 flagsMap map[string]string
33 args []string
34 expect testResult
35 }{
36 {
37 name: "list all hooks of a project using project name",
38 flagsMap: map[string]string{
39 "out": "json",
40 },
41 args: []string{"rebecca.gray/project19"},
42 expect: pass,
43 },
44 {
45 name: "list all hooks of a project using project id",
46 flagsMap: map[string]string{
47 "out": "json",
48 },
49 args: []string{"19"},
50 expect: pass,
51 },
52 }
53
54 for _, tc := range tt {
55 t.Run(tc.name, func(t *testing.T) {
56 execT := execTestCmdFlags{
57 t: t,
58 cmd: getProjectHooksCmd,
59 args: tc.args,
60 flagsMap: tc.flagsMap,
61 }
62 stdout, execResult := execT.executeCommand()
63 require.Equal(t, tc.expect, execResult,
64 printFlagsTable(tc.flagsMap, stdout))
65 if tc.expect == pass {
66 require.Contains(t, stdout, "url",
67 "'url' should be visible in output")
68 }
69 })
70 }
71}

Callers

nothing calls this directly

Calls 2

executeCommandMethod · 0.95
printFlagsTableFunction · 0.85

Tested by

no test coverage detected