testing

package
v0.0.0-...-ef901e4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 7, 2022 License: MIT Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AdminAuthHeaders

func AdminAuthHeaders(t *testing.T, deps *dspshttp.ServerDependencies) map[string]string

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

func AssertInternalServerErrorResponse(t *testing.T, res *http.Response)

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

func BodyJSONMapOfRes(t *testing.T, res *http.Response) map[string]interface{}

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

func BodyJSONOfRes(t *testing.T, res *http.Response, body interface{})

BodyJSONOfRes extract JSON from response body

func DoHTTPRequest

func DoHTTPRequest(t *testing.T, method string, url string, body string) *http.Response

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL