test

package
v0.30.19 Latest Latest
Warning

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

Go to latest
Published: Jan 9, 2023 License: AGPL-3.0, AGPL-3.0-only Imports: 44 Imported by: 0

Documentation

Index

Constants

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 AnyUserMock added in v0.30.16

func AnyUserMock() user.Repo

func GetGorm

func GetGorm(tb testing.TB) *gorm.DB

func GetQuery

func GetQuery(tb testing.TB) *query.Query

func GetRedis added in v0.23.7

func GetRedis(tb testing.TB) *redis.Client

func GetWebApp

func GetWebApp(tb testing.TB, m Mock) *echo.Echo

func MockAuthRepo

func MockAuthRepo(m auth.Repo) fx.Option

func MockAuthService

func MockAuthService(m auth.Service) fx.Option

func MockCache

func MockCache(mock cache.RedisCache) fx.Option

func MockCharacterRepo

func MockCharacterRepo(m character.Repo) fx.Option

func MockEmptyCache

func MockEmptyCache() fx.Option

func MockEpisodeRepo

func MockEpisodeRepo(m episode.Repo) fx.Option

func MockIndexRepo

func MockIndexRepo(repo index.Repo) fx.Option

func MockNoticationRepo added in v0.29.0

func MockNoticationRepo(repo notification.Repo) fx.Option

func MockPersonRepo

func MockPersonRepo(m person.Repo) fx.Option

func MockPrivateMessageRepo added in v0.29.0

func MockPrivateMessageRepo(repo pm.Repo) fx.Option

func MockRevisionRepo

func MockRevisionRepo(repo revision.Repo) fx.Option

func MockSessionManager

func MockSessionManager(repo session.Manager) fx.Option

func MockSubjectReadRepo added in v0.30.15

func MockSubjectReadRepo(m subject.CachedRepo) fx.Option

func MockSubjectRepo

func MockSubjectRepo(m subject.Repo) fx.Option

func MockTimeLineSrv added in v0.30.17

func MockTimeLineSrv(m timeline.Service) fx.Option

func MockUserRepo

func MockUserRepo(repo user.Repo) fx.Option

func RequireEnv

func RequireEnv(tb testing.TB, envs ...string)

RequireEnv

func TestGet(t *testing.T) {
  RequireEnv(t, test.EnvRedis, test.EnvMysql)
  ...
}

func RunAndCleanup

func RunAndCleanup(tb testing.TB, f func())

RunAndCleanup will run a function immediately and add it to t.Cleanup.

Types

type Mock

type Mock struct {
	SubjectRepo        subject.Repo
	SubjectCachedRepo  subject.CachedRepo
	PersonRepo         person.Repo
	CharacterRepo      character.Repo
	AuthRepo           auth.Repo
	AuthService        auth.Service
	EpisodeRepo        episode.Repo
	UserRepo           user.Repo
	IndexRepo          index.Repo
	RevisionRepo       revision.Repo
	CollectionRepo     collections.Repo
	TimeLineSrv        timeline.Service
	SessionManager     session.Manager
	Cache              cache.RedisCache
	PrivateMessageRepo pm.Repo
	NotificationRepo   notification.Repo
	HTTPMock           *httpmock.MockTransport
	Dam                *dam.Dam
}

Jump to

Keyboard shortcuts

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