testutils

package
v0.0.0-...-c4b140d Latest Latest
Warning

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

Go to latest
Published: Mar 18, 2023 License: GPL-3.0 Imports: 24 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ClearDB

func ClearDB() (err error)

func LoadEnvFile

func LoadEnvFile()

Types

type Env

type Env struct {
	User     firebase.UserInfo
	UserRepo UserRepository
	// contains filtered or unexported fields
}

func NewEnv

func NewEnv(handler http.Handler, userRepo UserRepository) (env *Env)

func (*Env) AddTestUser

func (env *Env) AddTestUser() (err error)

func (*Env) ClearDB

func (env *Env) ClearDB() (err error)

func (*Env) ClientAuthInfoWriter

func (env *Env) ClientAuthInfoWriter() runtime.ClientAuthInfoWriterFunc

func (*Env) CreateTestTopic

func (env *Env) CreateTestTopic(t *testing.T, client *googlePubsub.Client, topicName string)

func (*Env) DeleteTestTopic

func (env *Env) DeleteTestTopic(t *testing.T, client *googlePubsub.Client, topicName string)

func (*Env) GetXApigatewayAPIUserinfo

func (env *Env) GetXApigatewayAPIUserinfo() string

func (*Env) RemoveRole

func (env *Env) RemoveRole(role domain.Role) (err error)

func (*Env) SetRole

func (env *Env) SetRole(role domain.Role) (err error)

func (*Env) Transport

func (env *Env) Transport() runtime.ClientTransport

type TestClientTransport

type TestClientTransport struct {
	Server  *httptest.Server
	Handler http.Handler
}

ClientTransport implements ClientTransport from github.com/go-openapi/runtime it abstracts the request/client operation handling.

func NewTestClientTransport

func NewTestClientTransport(handler http.Handler) *TestClientTransport

func (*TestClientTransport) Submit

func (t *TestClientTransport) Submit(op *runtime.ClientOperation) (v interface{}, err error)

Submit method handles a client operation. client operation is transformed into an http.Request and submitted against the test server response is parsed the same way as the generated client does.

type UserRepository

type UserRepository interface {
	SaveUser(context.Context, domain.UserID, *models.User) (*models.User, error)
}

Env is an abstraction for running e2e tests

Jump to

Keyboard shortcuts

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