(t *testing.T)
| 37 | ) |
| 38 | |
| 39 | func TestWhoAmIRun(t *testing.T) { |
| 40 | tests := []struct { |
| 41 | name string |
| 42 | o *WhoAmIOptions |
| 43 | args []string |
| 44 | serverErr error |
| 45 | alphaDisabled bool |
| 46 | betaDisabled bool |
| 47 | stableDisabled bool |
| 48 | |
| 49 | expectedError error |
| 50 | expectedBodyStrings []string |
| 51 | }{ |
| 52 | { |
| 53 | name: "success test", |
| 54 | o: &WhoAmIOptions{ |
| 55 | resourcePrinterFunc: printTableSelfSubjectAccessReview, |
| 56 | }, |
| 57 | args: []string{}, |
| 58 | expectedBodyStrings: []string{ |
| 59 | `ATTRIBUTE VALUE`, |
| 60 | `Username jane.doe`, |
| 61 | `UID uniq-id`, |
| 62 | `Groups [students teachers]`, |
| 63 | `Extra: skills [reading learning]`, |
| 64 | `Extra: subjects [math sports]`, |
| 65 | ``, |
| 66 | }, |
| 67 | }, |
| 68 | { |
| 69 | name: "JSON test", |
| 70 | o: &WhoAmIOptions{ |
| 71 | resourcePrinterFunc: printers.NewTypeSetter(scheme.Scheme).ToPrinter(&printers.JSONPrinter{}).PrintObj, |
| 72 | }, |
| 73 | args: []string{}, |
| 74 | expectedBodyStrings: []string{ |
| 75 | `{ |
| 76 | "kind": "SelfSubjectReview", |
| 77 | "apiVersion": "authentication.k8s.io/v1", |
| 78 | "metadata": {}, |
| 79 | "status": { |
| 80 | "userInfo": { |
| 81 | "username": "jane.doe", |
| 82 | "uid": "uniq-id", |
| 83 | "groups": [ |
| 84 | "students", |
| 85 | "teachers" |
| 86 | ], |
| 87 | "extra": { |
| 88 | "skills": [ |
| 89 | "reading", |
| 90 | "learning" |
| 91 | ], |
| 92 | "subjects": [ |
| 93 | "math", |
| 94 | "sports" |
| 95 | ] |
| 96 | } |
nothing calls this directly
no test coverage detected
searching dependent graphs…