test

package
v0.0.0-...-4c71352 Latest Latest
Warning

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

Go to latest
Published: Apr 6, 2024 License: AGPL-3.0 Imports: 29 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddQuery

func AddQuery(req *http.Request, query ...string)

func Authenticated

func Authenticated(t testing.TB, req *http.Request, pool *pgxpool.Pool, conv *service.SessionJwtConverter, issuer, idAtIssuer string) (uuid.UUID, string, time.Time, time.Time)

func CreateAccount

func CreateAccount(t testing.TB, pool *pgxpool.Pool, id uuid.UUID, creationTime time.Time)

func CreateAccountAndFederation

func CreateAccountAndFederation(t testing.TB, pool *pgxpool.Pool, accountId uuid.UUID, issuer, idAtIssuer string, creationTime time.Time)

func CreateAccountFederation

func CreateAccountFederation(t testing.TB, pool *pgxpool.Pool, accountId uuid.UUID, issuer, idAtIssuer string)

func CreateGw2Account

func CreateGw2Account(t testing.TB, pool *pgxpool.Pool, accountId, gw2AccountId uuid.UUID, name, displayName string)

func CreateGw2AccountVerification

func CreateGw2AccountVerification(t testing.TB, pool *pgxpool.Pool, accountId, gw2AccountId uuid.UUID)

func CreateGw2ApiToken

func CreateGw2ApiToken(t testing.TB, pool *pgxpool.Pool, accountId, gw2AccountId uuid.UUID, token string, perms []gw2.Permission)

func CreateSession

func CreateSession(t testing.TB, pool *pgxpool.Pool, sessionId, issuer, idAtIssuer string, creationTime, expirationTime time.Time, metadata []byte)

func MustExec

func MustExec(t testing.TB, pool *pgxpool.Pool, sql string, args ...any)

func MustExist

func MustExist(t testing.TB, pool *pgxpool.Pool, sql string, args ...any) bool

func MustNotExist

func MustNotExist(t testing.TB, pool *pgxpool.Pool, sql string, args ...any) bool

func MustUnauthorized

func MustUnauthorized(t testing.TB, h http.Handler, req *http.Request) bool

func NewGw2ApiClient

func NewGw2ApiClient(handler http.Handler) (*httptest.Server, *gw2.ApiClient)

func NewRandomConverter

func NewRandomConverter(t testing.TB) *service.SessionJwtConverter

func NewUUID

func NewUUID(t testing.TB) uuid.UUID

func RunAll

func RunAll(t *testing.T, scope *Scope, tests map[string]map[string]Fn)

func WithGw2ApiClient

func WithGw2ApiClient(handler http.Handler, fn func(gw2ApiClient *gw2.ApiClient) error) error

func WithScope

func WithScope(fn func(scope *Scope))

Types

type Fn

type Fn func(t *testing.T, pool *pgxpool.Pool, conv *service.SessionJwtConverter, truncateTablesFn func() error)

type Scope

type Scope struct {
	// contains filtered or unexported fields
}

func (*Scope) Stop

func (s *Scope) Stop()

func (*Scope) WithPgx

func (s *Scope) WithPgx(fn func(pool *pgxpool.Pool, truncateTablesFn func() error) error) error

Jump to

Keyboard shortcuts

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