TestGetRequestMetadataBadSecurityLevel verifies the case where the securityLevel specified in the context passed to GetRequestMetadata is not sufficient.
(t *testing.T)
| 283 | // securityLevel specified in the context passed to GetRequestMetadata is not |
| 284 | // sufficient. |
| 285 | func (s) TestGetRequestMetadataBadSecurityLevel(t *testing.T) { |
| 286 | defer overrideSubjectTokenGood()() |
| 287 | |
| 288 | creds, err := NewCredentials(goodOptions) |
| 289 | if err != nil { |
| 290 | t.Fatalf("NewCredentials(%v) = %v", goodOptions, err) |
| 291 | } |
| 292 | |
| 293 | ctx, cancel := context.WithTimeout(context.Background(), defaultTestTimeout) |
| 294 | defer cancel() |
| 295 | gotMetadata, err := creds.GetRequestMetadata(createTestContext(ctx, credentials.IntegrityOnly), "") |
| 296 | if err == nil { |
| 297 | t.Fatalf("creds.GetRequestMetadata() succeeded with metadata %v, expected to fail", gotMetadata) |
| 298 | } |
| 299 | } |
| 300 | |
| 301 | // TestGetRequestMetadataCacheExpiry verifies the case where the cached access |
| 302 | // token has expired, and the credentials implementation will have to send a |
nothing calls this directly
no test coverage detected