MCPcopy
hub / github.com/minio/minio-go / TestCredentialsGet

Function TestCredentialsGet

pkg/credentials/credentials_test.go:45–68  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

43}
44
45func 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
70func TestCredentialsGetWithError(t *testing.T) {
71 c := New(&credProvider{err: errors.New("Custom error")})

Callers

nothing calls this directly

Calls 2

GetWithContextMethod · 0.80
NewFunction · 0.70

Tested by

no test coverage detected