(t *testing.T)
| 27 | ) |
| 28 | |
| 29 | func TestGetProjects(t *testing.T) { |
| 30 | tt := []struct { |
| 31 | name string |
| 32 | flagsMap map[string]string |
| 33 | expect testResult |
| 34 | }{ |
| 35 | { |
| 36 | name: "print in yaml", |
| 37 | flagsMap: map[string]string{ |
| 38 | "out": "yaml", |
| 39 | "statistics": "true", |
| 40 | }, |
| 41 | expect: pass, |
| 42 | }, |
| 43 | { |
| 44 | name: "print in json and use all flags", |
| 45 | flagsMap: map[string]string{ |
| 46 | "out": "json", |
| 47 | "archived": "false", |
| 48 | "search": "project23", |
| 49 | "simple": "false", |
| 50 | "owned": "false", |
| 51 | "sort": "desc", |
| 52 | "order-by": "name", |
| 53 | "membership": "false", |
| 54 | "starred": "false", |
| 55 | "statistics": "true", |
| 56 | "visibility": "private", |
| 57 | "with-issues-enabled": "false", |
| 58 | "with-merge-requests-enabled": "false", |
| 59 | }, |
| 60 | expect: pass, |
| 61 | }, |
| 62 | { |
| 63 | name: "print simple view with no flags", |
| 64 | expect: pass, |
| 65 | }, |
| 66 | { |
| 67 | name: "use from-group", |
| 68 | flagsMap: map[string]string{ |
| 69 | "from-group": "Group1", |
| 70 | }, |
| 71 | expect: pass, |
| 72 | }, |
| 73 | { |
| 74 | name: "invalid sort flag value must fail", |
| 75 | flagsMap: map[string]string{ |
| 76 | "sort": "xxx", |
| 77 | }, |
| 78 | expect: fail, |
| 79 | }, |
| 80 | { |
| 81 | name: "invalid order-by flag value must fail", |
| 82 | flagsMap: map[string]string{ |
| 83 | // fix the previous invalid sort value |
| 84 | "sort": "asc", |
| 85 | "order-by": "xxx", |
| 86 | }, |
nothing calls this directly
no test coverage detected