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

Function TestDescProject

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

Source from the content-addressed store, hash-verified

27)
28
29func TestDescProject(t *testing.T) {
30 setBasicAuthEnvs()
31 tt := []struct {
32 name string
33 flagsMap map[string]string
34 args []string
35 expect testResult
36 }{
37 {
38 name: "describe a project successfully",
39 args: []string{"Group2/project10"},
40 expect: pass,
41 },
42 {
43 name: "describe no args should fail",
44 expect: fail,
45 },
46 {
47 name: "invalid out flag should fail",
48 args: []string{"Group2/project10"},
49 flagsMap: map[string]string{
50 "out": "xxx",
51 },
52 expect: fail,
53 },
54 {
55 name: "describe non existent project should fail",
56 args: []string{"XXX"},
57 flagsMap: map[string]string{
58 // fix the value of the previous out flag
59 "out": "simple"},
60 expect: fail,
61 },
62 }
63
64 for _, tc := range tt {
65 t.Run(tc.name, func(t *testing.T) {
66 execT := execTestCmdFlags{
67 t: t,
68 cmd: descProjectCmd,
69 flagsMap: tc.flagsMap,
70 args: tc.args,
71 }
72 stdout, execResult := execT.executeCommand()
73 require.Equal(t, tc.expect, execResult,
74 printFlagsTable(tc.flagsMap, stdout))
75 })
76 }
77}

Callers

nothing calls this directly

Calls 3

executeCommandMethod · 0.95
setBasicAuthEnvsFunction · 0.85
printFlagsTableFunction · 0.85

Tested by

no test coverage detected