(t *testing.T)
| 201 | } |
| 202 | |
| 203 | func TestNeedsRetryOnInsuficientScope(t *testing.T) { |
| 204 | resp := registrySuseComResp |
| 205 | resp.Header["Www-Authenticate"] = []string{ |
| 206 | `Bearer realm="https://registry.suse.com/auth",service="SUSE Linux Docker Registry",scope="registry:catalog:*",error="insufficient_scope"`, |
| 207 | } |
| 208 | expectedScope := authScope{ |
| 209 | resourceType: "registry", |
| 210 | remoteName: "catalog", |
| 211 | actions: "*", |
| 212 | } |
| 213 | |
| 214 | needsRetry, scope := needsRetryWithUpdatedScope(&resp) |
| 215 | |
| 216 | if !needsRetry { |
| 217 | t.Fatal("Expected needing to retry") |
| 218 | } |
| 219 | |
| 220 | if expectedScope != *scope { |
| 221 | t.Fatalf("Got an invalid scope, expected '%q' but got '%q'", expectedScope, *scope) |
| 222 | } |
| 223 | } |
| 224 | |
| 225 | func TestNeedsRetryNoRetryWhenNoAuthHeader(t *testing.T) { |
| 226 | resp := registrySuseComResp |
nothing calls this directly
no test coverage detected
searching dependent graphs…