helpers

package
v0.0.0-...-5037bb9 Latest Latest
Warning

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

Go to latest
Published: Oct 19, 2021 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AssertGetSupplierResponse

func AssertGetSupplierResponse(t *testing.T, recorder *httptest.ResponseRecorder)

func AssertTokenResponse

func AssertTokenResponse(t *testing.T, testCase TestCaseValidateToken, gotClaims *helper.JwtCustomClaims, err error)

func AssertUserProfileResponse

func AssertUserProfileResponse(t *testing.T, recorder *httptest.ResponseRecorder)

func PrepareHandlerTestCase

func PrepareHandlerTestCase(test TestCaseHandler) (request *http.Request, recorder *httptest.ResponseRecorder)

Types

type ExpectedResponse

type ExpectedResponse struct {
	StatusCode int
	BodyPart   string
}

type Request

type Request struct {
	Method string
	Url    string
	Token  string
}

type TestCaseGetBearerToken

type TestCaseGetBearerToken struct {
	TestName     string
	BearerString string
	Want         string
}

type TestCaseHandler

type TestCaseHandler struct {
	TestName    string
	Request     Request
	Body        string
	HandlerFunc func(w http.ResponseWriter, r *http.Request)
	Want        ExpectedResponse
}

type TestCaseMiddleware

type TestCaseMiddleware struct {
	TestName    string
	Request     Request
	HeaderName  string
	HeaderValue string
	Want        ExpectedResponse
}

type TestCaseTokenHandler

type TestCaseTokenHandler struct {
	TestName    string
	Request     Request
	Body        *requests.LoginRequest
	HandlerFunc func(w http.ResponseWriter, r *http.Request)
	Want        ExpectedResponse
}

type TestCaseUserCreate

type TestCaseUserCreate struct {
	TestName     string
	User         *models.User
	Want         *models.User
	WantErr      bool
	WantErrorMsg string
}

type TestCaseUserGetByID

type TestCaseUserGetByID struct {
	TestName     string
	UserID       int32
	Want         *models.User
	WantErr      bool
	WantErrorMsg string
}

type TestCaseValidateToken

type TestCaseValidateToken struct {
	TestName     string
	AccessToken  string
	WantError    bool
	WantErrorMsg string
	WantID       int32
}

Jump to

Keyboard shortcuts

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