(t *testing.T)
| 9 | ) |
| 10 | |
| 11 | func TestNewGroup(t *testing.T) { |
| 12 | setBasicAuthEnvs() |
| 13 | tt := []struct { |
| 14 | name string |
| 15 | flagsMap map[string]string |
| 16 | args []string |
| 17 | expect testResult |
| 18 | }{ |
| 19 | { |
| 20 | name: "create group and print in yaml", |
| 21 | flagsMap: map[string]string{ |
| 22 | "desc": "Created by go test", |
| 23 | "namespace": "Group2", |
| 24 | "visibility": "private", |
| 25 | "lfs-enabled": "false", |
| 26 | "request-access-enabled": "false", |
| 27 | "out": "yaml", |
| 28 | }, |
| 29 | args: []string{"Test_New_Group_Under_Group1"}, |
| 30 | expect: pass, |
| 31 | }, |
| 32 | { |
| 33 | name: "create group and print in json with no namespace", |
| 34 | flagsMap: map[string]string{ |
| 35 | "desc": "Created by go test", |
| 36 | "visibility": "private", |
| 37 | "lfs-enabled": "false", |
| 38 | "request-access-enabled": "false", |
| 39 | "out": "json", |
| 40 | }, |
| 41 | args: []string{"Test_New_Group_Without_Namespace"}, |
| 42 | expect: pass, |
| 43 | }, |
| 44 | { |
| 45 | name: "create group using id in namespace", |
| 46 | flagsMap: map[string]string{ |
| 47 | "desc": "Created by go test", |
| 48 | "namespace": "14", // is Group2 |
| 49 | "visibility": "private", |
| 50 | "lfs-enabled": "false", |
| 51 | "request-access-enabled": "false", |
| 52 | }, |
| 53 | args: []string{"Test_New_Group_Using_Namespace"}, |
| 54 | expect: pass, |
| 55 | }, |
| 56 | { |
| 57 | name: "invalid visibility value must fail", |
| 58 | flagsMap: map[string]string{ |
| 59 | "visibility": "xxx", |
| 60 | }, |
| 61 | args: []string{"Dummy_Group"}, |
| 62 | expect: fail, |
| 63 | }, |
| 64 | } |
| 65 | |
| 66 | for _, tc := range tt { |
| 67 | t.Run(tc.name, func(t *testing.T) { |
| 68 | execT := execTestCmdFlags{ |
nothing calls this directly
no test coverage detected