Documentation
¶
Index ¶
- Constants
- func FxE2E(t *testing.T) fx.Option
- func GetGorm(tb testing.TB) *gorm.DB
- func GetQuery(tb testing.TB) *query.Query
- func GetWebApp(tb testing.TB, m Mock) *fiber.App
- func MockAuthRepo(m domain.AuthRepo) fx.Option
- func MockAuthService(m domain.AuthService) fx.Option
- func MockCache(mock cache.Generic) fx.Option
- func MockCaptchaManager(repo captcha.Manager) fx.Option
- func MockCharacterRepo(m domain.CharacterRepo) fx.Option
- func MockEmptyCache() fx.Option
- func MockEpisodeRepo(m domain.EpisodeRepo) fx.Option
- func MockIndexRepo(repo domain.IndexRepo) fx.Option
- func MockOAuthManager(m oauth.Manager) fx.Option
- func MockPersonRepo(m domain.PersonRepo) fx.Option
- func MockRateLimiter(repo rate.Manager) fx.Option
- func MockRevisionRepo(repo domain.RevisionRepo) fx.Option
- func MockSessionManager(repo session.Manager) fx.Option
- func MockSubjectRepo(m domain.SubjectRepo) fx.Option
- func MockUserRepo(repo domain.UserRepo) fx.Option
- func NopCache() cache.Generic
- func RequireEnv(tb testing.TB, envs ...string)
- func RunAndCleanup(tb testing.TB, f func())
- type Mock
- type PagedResponse
- type Request
- func (r *Request) Cookie(key, value string) *Request
- func (r *Request) Delete(path string) *Request
- func (r *Request) Execute(app *fiber.App, msTimeout ...int) *Response
- func (r *Request) Form(key, value string) *Request
- func (r *Request) Get(path string) *Request
- func (r *Request) Header(key, value string) *Request
- func (r *Request) JSON(v any) *Request
- func (r *Request) Patch(path string) *Request
- func (r *Request) Post(path string) *Request
- func (r *Request) Put(path string) *Request
- func (r *Request) Query(key, value string) *Request
- func (r *Request) StdRequest() *http.Request
- type Response
Constants ¶
View Source
const EnvExternalHTTP = "http" // external http server like hCaptcha
View Source
const EnvMysql = "mysql"
View Source
const EnvRedis = "redis"
View Source
const TreeHoleAccessToken = "a_development_access_token"
Variables ¶
This section is empty.
Functions ¶
func MockAuthService ¶ added in v0.14.0
func MockAuthService(m domain.AuthService) fx.Option
func MockCharacterRepo ¶
func MockCharacterRepo(m domain.CharacterRepo) fx.Option
func MockEmptyCache ¶
func MockEpisodeRepo ¶
func MockEpisodeRepo(m domain.EpisodeRepo) fx.Option
func MockPersonRepo ¶
func MockPersonRepo(m domain.PersonRepo) fx.Option
func MockRevisionRepo ¶ added in v0.10.1
func MockRevisionRepo(repo domain.RevisionRepo) fx.Option
func MockSubjectRepo ¶
func MockSubjectRepo(m domain.SubjectRepo) fx.Option
func RequireEnv ¶
RequireEnv
func TestGet(t *testing.T) {
RequireEnv(t, test.EnvRedis, test.EnvMysql)
...
}
func RunAndCleanup ¶ added in v0.20.4
RunAndCleanup will run a function immediately and add it to t.Cleanup.
Types ¶
type Mock ¶
type Mock struct {
SubjectRepo domain.SubjectRepo
PersonRepo domain.PersonRepo
CharacterRepo domain.CharacterRepo
AuthRepo domain.AuthRepo
AuthService domain.AuthService
EpisodeRepo domain.EpisodeRepo
GroupRepo domain.GroupRepo
UserRepo domain.UserRepo
IndexRepo domain.IndexRepo
RevisionRepo domain.RevisionRepo
CollectionRepo domain.CollectionRepo
CaptchaManager captcha.Manager
SessionManager session.Manager
Cache cache.Generic
RateLimiter rate.Manager
OAuthManager oauth.Manager
HTTPMock *httpmock.MockTransport
}
type PagedResponse ¶ added in v0.20.9
type PagedResponse struct {
Data json.RawMessage `json:"data"`
Total int64 `json:"total"`
Limit int `json:"limit"`
Offset int `json:"offset"`
}
type Request ¶ added in v0.11.1
type Request struct {
// contains filtered or unexported fields
}
func (*Request) StdRequest ¶ added in v0.11.1
type Response ¶ added in v0.11.1
type Response struct {
Header http.Header
Body []byte
StatusCode int
// contains filtered or unexported fields
}
func (*Response) BodyString ¶ added in v0.11.1
func (*Response) ExpectCode ¶ added in v0.11.1
Click to show internal directories.
Click to hide internal directories.