(t *testing.T)
| 28 | ) |
| 29 | |
| 30 | func TestDescUser(t *testing.T) { |
| 31 | tt := []struct { |
| 32 | name string |
| 33 | args []string |
| 34 | expect testResult |
| 35 | }{ |
| 36 | { |
| 37 | name: "describe existing username successfully", |
| 38 | args: []string{"matt.hunter"}, |
| 39 | expect: pass, |
| 40 | }, |
| 41 | { |
| 42 | name: "describe existing user id successfully", |
| 43 | args: []string{"3"}, |
| 44 | expect: pass, |
| 45 | }, |
| 46 | { |
| 47 | name: "describe non existent user id should fail", |
| 48 | args: []string{"999"}, |
| 49 | expect: fail, |
| 50 | }, |
| 51 | } |
| 52 | |
| 53 | for _, tc := range tt { |
| 54 | t.Run(tc.name, func(t *testing.T) { |
| 55 | execT := execTestCmdFlags{ |
| 56 | t: t, |
| 57 | cmd: descUserCmd, |
| 58 | args: tc.args, |
| 59 | } |
| 60 | stdout, execResult := execT.executeCommand() |
| 61 | fmt.Println(stdout) |
| 62 | require.Equal(t, tc.expect, execResult, tc.args[0], stdout) |
| 63 | }) |
| 64 | } |
| 65 | } |
nothing calls this directly
no test coverage detected