(t *testing.T)
| 25 | ) |
| 26 | |
| 27 | func TestGetBranchCmd(t *testing.T) { |
| 28 | tt := []struct { |
| 29 | name string |
| 30 | args []string |
| 31 | expect testResult |
| 32 | expectOut []string |
| 33 | }{ |
| 34 | { |
| 35 | name: "get branches of a project", |
| 36 | args: []string{"12"}, |
| 37 | expect: pass, |
| 38 | expectOut: []string{"master"}, |
| 39 | }, |
| 40 | { |
| 41 | name: "get branches of a non existent project fails", |
| 42 | args: []string{"xxx"}, |
| 43 | expect: fail, |
| 44 | expectOut: []string{`message: 404 Project Not Found`}, |
| 45 | }, |
| 46 | } |
| 47 | |
| 48 | for _, tc := range tt { |
| 49 | t.Run(tc.name, func(t *testing.T) { |
| 50 | execT := execTestCmdFlags{ |
| 51 | t: t, |
| 52 | cmd: getBranchCmd, |
| 53 | args: tc.args, |
| 54 | } |
| 55 | stdout, execResult := execT.executeCommand() |
| 56 | assertEqualResult(t, execResult, tc.expect, stdout) |
| 57 | assertOutContains(t, stdout, tc.expectOut...) |
| 58 | }) |
| 59 | } |
| 60 | |
| 61 | } |
nothing calls this directly
no test coverage detected