github.com/versent/saml2aws@v2.17.0+incompatible/pkg/provider/onelogin/mock/provider.go (about) 1 package mock 2 3 import ( 4 "net/http" 5 "net/http/httptest" 6 "testing" 7 ) 8 9 // New returns an instance of the mock OneLogin indetity provider. 10 func New(t *testing.T, requests []ExpectedRequest) *httptest.Server { 11 h := mockHandler(t, requests) 12 return httptest.NewServer(h) 13 } 14 15 // ExpectedRequest represents a request that the mock identity provider expects and its predefined response. 16 type ExpectedRequest struct { 17 reqBody []byte 18 reqHeaders http.Header 19 reqMethod string 20 reqPath string 21 22 resBody []byte 23 resHeaders http.Header 24 resStatus int 25 } 26 27 func mockHandler(t *testing.T, requests []ExpectedRequest) http.Handler { 28 // WIP 29 return http.NotFoundHandler() 30 }