(t *testing.T)
| 30 | ) |
| 31 | |
| 32 | func TestDeleteGroup(t *testing.T) { |
| 33 | setBasicAuthEnvs() |
| 34 | tt := []struct { |
| 35 | name string |
| 36 | args []string |
| 37 | expect testResult |
| 38 | }{ |
| 39 | { |
| 40 | name: "delete an existing group", |
| 41 | args: []string{"GroupTBD"}, |
| 42 | expect: pass, |
| 43 | }, |
| 44 | { |
| 45 | name: "deleting a non existent group should fail", |
| 46 | args: []string{"GroupUnknown"}, |
| 47 | expect: fail, |
| 48 | }, |
| 49 | } |
| 50 | |
| 51 | for _, tc := range tt { |
| 52 | t.Run(tc.name, func(t *testing.T) { |
| 53 | // SETUP: |
| 54 | // create the test group to be deleted |
| 55 | if tc.expect == pass { |
| 56 | if _, err := newGroup(&gitlab.CreateGroupOptions{ |
| 57 | Path: gitlab.String(tc.args[0]), |
| 58 | Name: gitlab.String(tc.args[0]), |
| 59 | }); err != nil { |
| 60 | tInfo("Test data setup failure for delete group") |
| 61 | os.Exit(1) |
| 62 | } |
| 63 | tInfo("Test group to be deleted is created") |
| 64 | } |
| 65 | |
| 66 | execT := execTestCmdFlags{ |
| 67 | t: t, |
| 68 | cmd: deleteGroupCmd, |
| 69 | args: tc.args, |
| 70 | } |
| 71 | stdout, execResult := execT.executeCommand() |
| 72 | fmt.Println(stdout) |
| 73 | require.Equal(t, tc.expect, execResult, stdout) |
| 74 | }) |
| 75 | } |
| 76 | } |
nothing calls this directly
no test coverage detected