Documentation ¶
Index ¶
- func AdminAuthHeaders(t *testing.T, deps *dspshttp.ServerDependencies) map[string]string
- func AssertErrorResponse(t *testing.T, res *http.Response, httpStatus int, ...)
- func AssertInternalServerErrorResponse(t *testing.T, res *http.Response)
- func AssertRecordedCode(t *testing.T, rec *httptest.ResponseRecorder, httpStatusCode int, ...)
- func AssertResponseJSON(t *testing.T, res *http.Response, httpStatus int, ...) map[string]interface{}
- func BodyJSONMapOfRec(t *testing.T, rec *httptest.ResponseRecorder) map[string]interface{}
- func BodyJSONMapOfRes(t *testing.T, res *http.Response) map[string]interface{}
- func BodyJSONOfRec(t *testing.T, rec *httptest.ResponseRecorder, body interface{})
- func BodyJSONOfRes(t *testing.T, res *http.Response, body interface{})
- func DoHTTPRequest(t *testing.T, method string, url string, body string) *http.Response
- func DoHTTPRequestWithHeaders(t *testing.T, method string, url string, headers map[string]string, ...) *http.Response
- func NewMockStorages(ctrl *gomock.Controller) (storage *mock.MockStorage, pubsub *mock.MockPubSubStorage, ...)
- func WithServer(t *testing.T, configYaml string, setup func(deps *http.ServerDependencies), ...)
- func WithServerDeps(t *testing.T, configYaml string, f func(*http.ServerDependencies))
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AdminAuthHeaders ¶
AdminAuthHeaders make HTTP headers for Admin API call
func AssertErrorResponse ¶
func AssertErrorResponse(t *testing.T, res *http.Response, httpStatus int, dspsError domain.ErrorWithCode, messageRegex string)
AssertErrorResponse ensure DSPS standard error response
func AssertInternalServerErrorResponse ¶
AssertInternalServerErrorResponse ensure 500 response
func AssertRecordedCode ¶
func AssertRecordedCode(t *testing.T, rec *httptest.ResponseRecorder, httpStatusCode int, dspsCode domain.ErrorWithCode)
AssertRecordedCode assert DSPS standard HTTP error response
func AssertResponseJSON ¶
func AssertResponseJSON(t *testing.T, res *http.Response, httpStatus int, expected map[string]interface{}) map[string]interface{}
AssertResponseJSON ensure response body JSON content
func BodyJSONMapOfRec ¶
func BodyJSONMapOfRec(t *testing.T, rec *httptest.ResponseRecorder) map[string]interface{}
BodyJSONMapOfRec extract JSON from response body
func BodyJSONMapOfRes ¶
BodyJSONMapOfRes extract JSON from response body
func BodyJSONOfRec ¶
func BodyJSONOfRec(t *testing.T, rec *httptest.ResponseRecorder, body interface{})
BodyJSONOfRec extract JSON from response body
func BodyJSONOfRes ¶
BodyJSONOfRes extract JSON from response body
func DoHTTPRequest ¶
DoHTTPRequest performs HTTP request
func DoHTTPRequestWithHeaders ¶
func DoHTTPRequestWithHeaders(t *testing.T, method string, url string, headers map[string]string, body string) *http.Response
DoHTTPRequestWithHeaders performs HTTP request
func NewMockStorages ¶
func NewMockStorages(ctrl *gomock.Controller) (storage *mock.MockStorage, pubsub *mock.MockPubSubStorage, jwts *mock.MockJwtStorage)
NewMockStorages creates storage mock objects
func WithServer ¶
func WithServer(t *testing.T, configYaml string, setup func(deps *http.ServerDependencies), f func(deps *http.ServerDependencies, baseURL string))
WithServer runs given test function with HTTP server
func WithServerDeps ¶
func WithServerDeps(t *testing.T, configYaml string, f func(*http.ServerDependencies))
WithServerDeps runs given test function with ServerDependencies
Types ¶
This section is empty.