Documentation
¶
Index ¶
- func Auth(t *testing.T, tr *Request, p endpoint.Core) (userToken string, userID string)
- func EnsureBadRequest(t *testing.T, w *httptest.ResponseRecorder) *model.BadRequestResponse
- func EnsureCreated(t *testing.T, w *httptest.ResponseRecorder) *model.CreatedResponse
- func EnsureInternalServerError(t *testing.T, w *httptest.ResponseRecorder) *model.InternalServerErrorResponse
- func EnsureOK(t *testing.T, w *httptest.ResponseRecorder) *model.OKResponse
- func EnsureUnauthorized(t *testing.T, w *httptest.ResponseRecorder) *model.UnauthorizedResponse
- func LoadDatabase(ml logger.ILog) *database.DBW
- func Register(t *testing.T, tr *Request, p endpoint.Core) (userID string)
- func TeardownDatabase(db *database.DBW)
- func ToJSON(values url.Values) string
- type Context
- type CoreTest
- type MockLogger
- type MockPasshash
- type MockToken
- type Mocks
- type Request
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func EnsureBadRequest ¶
func EnsureBadRequest(t *testing.T, w *httptest.ResponseRecorder) *model.BadRequestResponse
EnsureBadRequest tests for HTTP status 400.
func EnsureCreated ¶
func EnsureCreated(t *testing.T, w *httptest.ResponseRecorder) *model.CreatedResponse
EnsureCreated tests for http status 201.
func EnsureInternalServerError ¶
func EnsureInternalServerError(t *testing.T, w *httptest.ResponseRecorder) *model.InternalServerErrorResponse
EnsureInternalServerError tests for http status 500.
func EnsureOK ¶
func EnsureOK(t *testing.T, w *httptest.ResponseRecorder) *model.OKResponse
EnsureOK tests for HTTP status 200.
func EnsureUnauthorized ¶
func EnsureUnauthorized(t *testing.T, w *httptest.ResponseRecorder) *model.UnauthorizedResponse
EnsureUnauthorized tests for HTTP status 401.
func LoadDatabase ¶
LoadDatabase will set up the DB and apply migrations for the tests.
func TeardownDatabase ¶
TeardownDatabase will destroy the test database.
Types ¶
type MockLogger ¶
type MockLogger struct { FatalfFunc func(format string, v ...interface{}) PrintfFunc func(format string, v ...interface{}) }
MockLogger is a mocked logger.
func NewMockLogger ¶
func NewMockLogger() *MockLogger
NewMockLogger is a mocked logger that displays nothing by default.
type MockPasshash ¶
MockPasshash is a mocked passhash.
type MockToken ¶
type MockToken struct { GenerateFunc func(userID string) (string, error) VerifyValue string VerifyError error }
MockToken is a mocked webtoken.
type Mocks ¶
type Mocks struct { Log *MockLogger Mock *mock.Mocker }
Mocks contains all the configurable dependencies.
type Request ¶
type Request struct { // Request is cleared before use. Request *http.Request // Header clears after use. Header http.Header // SkipMiddleware resets to false after use. SkipMiddleware bool // SkipRoutes resets to false after use. SkipRoutes bool }
Request is a test request.
Click to show internal directories.
Click to hide internal directories.