(t *testing.T)
| 28 | ) |
| 29 | |
| 30 | func TestGetUsers(t *testing.T) { |
| 31 | tt := []struct { |
| 32 | name string |
| 33 | flagsMap map[string]string |
| 34 | expect testResult |
| 35 | }{ |
| 36 | { |
| 37 | name: "lookup by username and print in yaml", |
| 38 | flagsMap: map[string]string{ |
| 39 | "username": "frank.watson", |
| 40 | "out": "yaml", |
| 41 | }, |
| 42 | expect: pass, |
| 43 | }, |
| 44 | { |
| 45 | name: "lookup by search and print in json", |
| 46 | flagsMap: map[string]string{ |
| 47 | "search": "paul", |
| 48 | "out": "json", |
| 49 | }, |
| 50 | expect: pass, |
| 51 | }, |
| 52 | { |
| 53 | name: "lookup by active users", |
| 54 | flagsMap: map[string]string{ |
| 55 | "active": "true", |
| 56 | }, |
| 57 | expect: pass, |
| 58 | }, |
| 59 | { |
| 60 | name: "lookup by blocked users", |
| 61 | flagsMap: map[string]string{ |
| 62 | "active": "false", |
| 63 | "blocked": "true", |
| 64 | }, |
| 65 | expect: pass, |
| 66 | }, |
| 67 | { |
| 68 | name: "lookup by create dates", |
| 69 | flagsMap: map[string]string{ |
| 70 | "created-after": "2018", |
| 71 | "created-before": "2019-05-31", |
| 72 | }, |
| 73 | expect: pass, |
| 74 | }, |
| 75 | { |
| 76 | name: "invalid order-by flag value should fail", |
| 77 | flagsMap: map[string]string{ |
| 78 | "order-by": "xxx", |
| 79 | }, |
| 80 | expect: fail, |
| 81 | }, |
| 82 | { |
| 83 | name: "invalid sort flag value should fail", |
| 84 | flagsMap: map[string]string{ |
| 85 | "sort": "xxx", |
| 86 | }, |
| 87 | expect: fail, |
nothing calls this directly
no test coverage detected