(t *testing.T)
| 8 | ) |
| 9 | |
| 10 | func TestExpandScopes(t *testing.T) { |
| 11 | tests := []struct { |
| 12 | name string |
| 13 | required []Scope |
| 14 | expected []string |
| 15 | }{ |
| 16 | { |
| 17 | name: "nil returns nil", |
| 18 | required: nil, |
| 19 | expected: nil, |
| 20 | }, |
| 21 | { |
| 22 | name: "empty returns nil", |
| 23 | required: []Scope{}, |
| 24 | expected: nil, |
| 25 | }, |
| 26 | { |
| 27 | name: "repo scope returns just repo", |
| 28 | required: []Scope{Repo}, |
| 29 | expected: []string{"repo"}, |
| 30 | }, |
| 31 | { |
| 32 | name: "public_repo also accepts repo (parent)", |
| 33 | required: []Scope{PublicRepo}, |
| 34 | expected: []string{"public_repo", "repo"}, |
| 35 | }, |
| 36 | { |
| 37 | name: "security_events also accepts repo (parent)", |
| 38 | required: []Scope{SecurityEvents}, |
| 39 | expected: []string{"repo", "security_events"}, |
| 40 | }, |
| 41 | { |
| 42 | name: "read:org also accepts write:org and admin:org (parents)", |
| 43 | required: []Scope{ReadOrg}, |
| 44 | expected: []string{"admin:org", "read:org", "write:org"}, |
| 45 | }, |
| 46 | { |
| 47 | name: "write:org also accepts admin:org (parent)", |
| 48 | required: []Scope{WriteOrg}, |
| 49 | expected: []string{"admin:org", "write:org"}, |
| 50 | }, |
| 51 | { |
| 52 | name: "admin:org returns just admin:org (no parent)", |
| 53 | required: []Scope{AdminOrg}, |
| 54 | expected: []string{"admin:org"}, |
| 55 | }, |
| 56 | { |
| 57 | name: "read:project also accepts project (parent)", |
| 58 | required: []Scope{ReadProject}, |
| 59 | expected: []string{"project", "read:project"}, |
| 60 | }, |
| 61 | { |
| 62 | name: "project returns just project (no parent)", |
| 63 | required: []Scope{Project}, |
| 64 | expected: []string{"project"}, |
| 65 | }, |
| 66 | { |
| 67 | name: "gist returns just gist (no parent)", |
nothing calls this directly
no test coverage detected