(t *testing.T)
| 43 | } |
| 44 | |
| 45 | func TestCredentialsGet(t *testing.T) { |
| 46 | c := New(&credProvider{ |
| 47 | creds: Value{ |
| 48 | AccessKeyID: "UXHW", |
| 49 | SecretAccessKey: "MYSECRET", |
| 50 | SessionToken: "", |
| 51 | }, |
| 52 | expired: true, |
| 53 | }) |
| 54 | |
| 55 | creds, err := c.GetWithContext(defaultCredContext) |
| 56 | if err != nil { |
| 57 | t.Fatal(err) |
| 58 | } |
| 59 | if creds.AccessKeyID != "UXHW" { |
| 60 | t.Errorf("Expected \"UXHW\", got %s", creds.AccessKeyID) |
| 61 | } |
| 62 | if creds.SecretAccessKey != "MYSECRET" { |
| 63 | t.Errorf("Expected \"MYSECRET\", got %s", creds.SecretAccessKey) |
| 64 | } |
| 65 | if creds.SessionToken != "" { |
| 66 | t.Errorf("Expected session token to be empty, got %s", creds.SessionToken) |
| 67 | } |
| 68 | } |
| 69 | |
| 70 | func TestCredentialsGetWithError(t *testing.T) { |
| 71 | c := New(&credProvider{err: errors.New("Custom error")}) |
nothing calls this directly
no test coverage detected