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

Function TestGetBranchCmd

cmd/get_branch_test.go:27–61  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

25)
26
27func TestGetBranchCmd(t *testing.T) {
28 tt := []struct {
29 name string
30 args []string
31 expect testResult
32 expectOut []string
33 }{
34 {
35 name: "get branches of a project",
36 args: []string{"12"},
37 expect: pass,
38 expectOut: []string{"master"},
39 },
40 {
41 name: "get branches of a non existent project fails",
42 args: []string{"xxx"},
43 expect: fail,
44 expectOut: []string{`message: 404 Project Not Found`},
45 },
46 }
47
48 for _, tc := range tt {
49 t.Run(tc.name, func(t *testing.T) {
50 execT := execTestCmdFlags{
51 t: t,
52 cmd: getBranchCmd,
53 args: tc.args,
54 }
55 stdout, execResult := execT.executeCommand()
56 assertEqualResult(t, execResult, tc.expect, stdout)
57 assertOutContains(t, stdout, tc.expectOut...)
58 })
59 }
60
61}

Callers

nothing calls this directly

Calls 3

executeCommandMethod · 0.95
assertEqualResultFunction · 0.85
assertOutContainsFunction · 0.85

Tested by

no test coverage detected