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

Function TestGetGroups

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

Source from the content-addressed store, hash-verified

27)
28
29func TestGetGroups(t *testing.T) {
30 setBasicAuthEnvs()
31 tt := []struct {
32 name string
33 flagsMap map[string]string
34 expect testResult
35 }{
36 {
37 name: "print in yaml",
38 flagsMap: map[string]string{
39 "out": "yaml",
40 },
41 expect: pass,
42 },
43 {
44 name: "print in json and use all flags",
45 flagsMap: map[string]string{
46 "all-available": "true",
47 "owned": "true",
48 "statistics": "true",
49 "search": "Group1",
50 "sort": "asc",
51 "order-by": "path",
52 "out": "json",
53 },
54 expect: pass,
55 },
56 {
57 name: "print in simple view with no flags",
58 expect: pass,
59 },
60 {
61 name: "get subgroups using from-group flag",
62 flagsMap: map[string]string{
63 "from-group": "Group1",
64 },
65 expect: pass,
66 },
67 {
68 name: "invalid sort value must fail",
69 flagsMap: map[string]string{
70 "sort": "xxx",
71 },
72 expect: fail,
73 },
74 {
75 name: "invalid order-by value must fail",
76 flagsMap: map[string]string{
77 // NOTE(@bzon): i had to set sort to correct value
78 // it is not being reset to default..
79 "sort": "asc",
80 "order-by": "xxx",
81 },
82 expect: fail,
83 },
84 }
85
86 for _, tc := range tt {

Callers

nothing calls this directly

Calls 3

executeCommandMethod · 0.95
setBasicAuthEnvsFunction · 0.85
printFlagsTableFunction · 0.85

Tested by

no test coverage detected