(t *testing.T)
| 25 | ) |
| 26 | |
| 27 | func TestRepositoryScope(t *testing.T) { |
| 28 | testCases := []struct { |
| 29 | refspec reference.Spec |
| 30 | push bool |
| 31 | expected string |
| 32 | }{ |
| 33 | { |
| 34 | refspec: reference.Spec{ |
| 35 | Locator: "host/foo/bar", |
| 36 | Object: "ignored", |
| 37 | }, |
| 38 | push: false, |
| 39 | expected: "repository:foo/bar:pull", |
| 40 | }, |
| 41 | { |
| 42 | refspec: reference.Spec{ |
| 43 | Locator: "host:4242/foo/bar", |
| 44 | Object: "ignored", |
| 45 | }, |
| 46 | push: true, |
| 47 | expected: "repository:foo/bar:pull,push", |
| 48 | }, |
| 49 | } |
| 50 | for _, x := range testCases { |
| 51 | t.Run(x.refspec.String(), func(t *testing.T) { |
| 52 | actual, err := RepositoryScope(x.refspec, x.push) |
| 53 | assert.NoError(t, err) |
| 54 | assert.Equal(t, x.expected, actual) |
| 55 | }) |
| 56 | } |
| 57 | } |
| 58 | |
| 59 | func TestGetTokenScopes(t *testing.T) { |
| 60 | testCases := []struct { |
nothing calls this directly
no test coverage detected
searching dependent graphs…