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

Function initStsTestServer

pkg/credentials/iam_aws_test.go:137–155  ·  view source on GitHub ↗
(expireOn string)

Source from the content-addressed store, hash-verified

135}
136
137func initStsTestServer(expireOn string) *httptest.Server {
138 server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
139 if err := r.ParseForm(); err != nil {
140 http.Error(w, err.Error(), http.StatusBadRequest)
141 return
142 }
143 required := []string{"RoleArn", "RoleSessionName", "WebIdentityToken", "Version"}
144 for _, field := range required {
145 if _, ok := r.Form[field]; !ok {
146 http.Error(w, fmt.Sprintf("%s missing", field), http.StatusBadRequest)
147 return
148 }
149 }
150
151 fmt.Fprintf(w, credsRespStsImpl, expireOn)
152 }))
153
154 return server
155}
156
157func TestIAMMalformedEndpoint(t *testing.T) {
158 creds := NewIAM("%%%%")

Callers 2

TestStsFunction · 0.85
TestStsCnFunction · 0.85

Calls 1

ErrorMethod · 0.45

Tested by

no test coverage detected