...
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18 package remote
19
20 import (
21 "net/http"
22 "testing"
23
24 "github.com/google/go-containerregistry/pkg/authn"
25 "github.com/google/go-containerregistry/pkg/name"
26 )
27
28 func TestCheckPushPermission_Real(t *testing.T) {
29
30
31 for _, r := range []name.Reference{
32 name.MustParseReference("ubuntu"),
33 name.MustParseReference("google/cloud-sdk"),
34 name.MustParseReference("microsoft/dotnet:sdk"),
35 name.MustParseReference("gcr.io/non-existent-project/made-up"),
36 name.MustParseReference("gcr.io/google-containers/foo"),
37 name.MustParseReference("quay.io/username/reponame"),
38 } {
39 t.Run(r.String(), func(t *testing.T) {
40 t.Parallel()
41 if err := CheckPushPermission(r, authn.DefaultKeychain, http.DefaultTransport); err == nil {
42 t.Errorf("CheckPushPermission(%s) returned nil", r)
43 }
44 })
45 }
46 }
47
View as plain text