(t *testing.T)
| 27 | ) |
| 28 | |
| 29 | func TestGetGroups(t *testing.T) { |
| 30 | setBasicAuthEnvs() |
| 31 | tt := []struct { |
| 32 | name string |
| 33 | flagsMap map[string]string |
| 34 | expect testResult |
| 35 | }{ |
| 36 | { |
| 37 | name: "print in yaml", |
| 38 | flagsMap: map[string]string{ |
| 39 | "out": "yaml", |
| 40 | }, |
| 41 | expect: pass, |
| 42 | }, |
| 43 | { |
| 44 | name: "print in json and use all flags", |
| 45 | flagsMap: map[string]string{ |
| 46 | "all-available": "true", |
| 47 | "owned": "true", |
| 48 | "statistics": "true", |
| 49 | "search": "Group1", |
| 50 | "sort": "asc", |
| 51 | "order-by": "path", |
| 52 | "out": "json", |
| 53 | }, |
| 54 | expect: pass, |
| 55 | }, |
| 56 | { |
| 57 | name: "print in simple view with no flags", |
| 58 | expect: pass, |
| 59 | }, |
| 60 | { |
| 61 | name: "get subgroups using from-group flag", |
| 62 | flagsMap: map[string]string{ |
| 63 | "from-group": "Group1", |
| 64 | }, |
| 65 | expect: pass, |
| 66 | }, |
| 67 | { |
| 68 | name: "invalid sort value must fail", |
| 69 | flagsMap: map[string]string{ |
| 70 | "sort": "xxx", |
| 71 | }, |
| 72 | expect: fail, |
| 73 | }, |
| 74 | { |
| 75 | name: "invalid order-by value must fail", |
| 76 | flagsMap: map[string]string{ |
| 77 | // NOTE(@bzon): i had to set sort to correct value |
| 78 | // it is not being reset to default.. |
| 79 | "sort": "asc", |
| 80 | "order-by": "xxx", |
| 81 | }, |
| 82 | expect: fail, |
| 83 | }, |
| 84 | } |
| 85 | |
| 86 | for _, tc := range tt { |
nothing calls this directly
no test coverage detected