MCPcopy Create free account
hub / github.com/devopsctl/gitlabctl / TestNewBranch

Function TestNewBranch

cmd/new_branch_test.go:28–70  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

26)
27
28func TestNewBranch(t *testing.T) {
29 tt := []struct {
30 name string
31 flagsMap map[string]string
32 args []string
33 expect testResult
34 }{
35 {
36 name: "create a new branch",
37 flagsMap: map[string]string{
38 "project": "Group2/project12",
39 "ref": "master",
40 },
41 args: []string{"release-xy"},
42 expect: pass,
43 },
44 {
45 name: "flags must be required",
46 args: []string{"master"},
47 expect: fail,
48 },
49 }
50
51 for _, tc := range tt {
52 t.Run(tc.name, func(t *testing.T) {
53 execT := execTestCmdFlags{
54 t: t,
55 cmd: newBranchCmd,
56 flagsMap: tc.flagsMap,
57 args: tc.args,
58 }
59 stdout, execResult := execT.executeCommand()
60 fmt.Println(stdout)
61 assertEqualResult(t, execResult, tc.expect, printFlagsTable(tc.flagsMap, stdout))
62 if tc.expect == pass {
63 assertOutContains(t, stdout, tc.args[0])
64 if err := deleteBranch(tc.flagsMap["project"], tc.args[0]); err != nil {
65 tInfo(err)
66 }
67 }
68 })
69 }
70}

Callers

nothing calls this directly

Calls 6

executeCommandMethod · 0.95
assertEqualResultFunction · 0.85
printFlagsTableFunction · 0.85
assertOutContainsFunction · 0.85
deleteBranchFunction · 0.85
tInfoFunction · 0.85

Tested by

no test coverage detected