Documentation ¶
Index ¶
- func AuthUserMiddleware(user *model.AccountDTO) gin.HandlerFunc
- func FakeAdminLoggedInMiddlewware(ctx *gin.Context)
- func FakeUserLoggedInMiddlewware(ctx *gin.Context)
- func GetTestConfigurationAndDependencies(t *testing.T, ctx context.Context, logger *logrus.Logger) (*config.Config, *dependencies.Dependencies)
- func GetValidBookmark() *model.BookmarkDTO
- func NewGin() *gin.Engine
- func NewTestResponseFromBytes(b []byte) (*testResponse, error)
- func NewTestResponseFromReader(r io.Reader) (*testResponse, error)
- func PerformRequest(handler http.Handler, method, path string, options ...Option) *httptest.ResponseRecorder
- func PerformRequestWithRecorder(recorder *httptest.ResponseRecorder, r http.Handler, method, path string, ...) *httptest.ResponseRecorder
- type Option
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AuthUserMiddleware ¶ added in v1.7.1
func AuthUserMiddleware(user *model.AccountDTO) gin.HandlerFunc
AuthUserMiddleware is a middleware that manually sets an user as authenticated in the context to be used in tests.
func FakeAdminLoggedInMiddlewware ¶ added in v1.7.1
FakeAdminLoggedInMiddlewware is a middleware that sets a fake admin account to context. Keep in mind that this users is not saved in database so any tests that use this middleware should not rely on database.
func FakeUserLoggedInMiddlewware ¶ added in v1.7.1
FakeUserLoggedInMiddlewware is a middleware that sets a fake user account to context. Keep in mind that this users is not saved in database so any tests that use this middleware should not rely on database.
func GetTestConfigurationAndDependencies ¶
func GetTestConfigurationAndDependencies(t *testing.T, ctx context.Context, logger *logrus.Logger) (*config.Config, *dependencies.Dependencies)
func GetValidBookmark ¶
func GetValidBookmark() *model.BookmarkDTO
func PerformRequest ¶
func PerformRequestWithRecorder ¶
func PerformRequestWithRecorder(recorder *httptest.ResponseRecorder, r http.Handler, method, path string, options ...Option) *httptest.ResponseRecorder
Types ¶
Click to show internal directories.
Click to hide internal directories.