testutils

package
v0.0.0-...-2a449b3 Latest Latest
Warning

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

Go to latest
Published: Jan 21, 2025 License: AGPL-3.0 Imports: 31 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateTestClient

func CreateTestClient(t testing.TB, url string) *httpexpect.Expect

CreateTestClient setup an httpexpect.Expect client used to make http tests.

This init take allow to use the `--debug` flag in your tests in order to print the requests/responses content.

example: `go test ./web/permissions --debug`.

func DisableManager

func DisableManager(inst *instance.Instance, shouldRemoveUUID bool) error

func NeedCouchdb

func NeedCouchdb(t *testing.T)

NeedCouchdb kill the process if there is no couchdb running

func TODO

func TODO(t *testing.T, date string, args ...interface{})

TODO can be used as a reminder to do something in the future. The test that calls TODO will fail after the limit date, which is an efficient way to not forget about it.

func WithFlag

func WithFlag(t *testing.T, inst *instance.Instance, name string, value interface{})

func WithManager

func WithManager(t *testing.T, inst *instance.Instance, managerConfig ManagerConfig) (shouldRemoveUUID bool)

Types

type ManagerConfig

type ManagerConfig struct {
	URL              string
	WithPremiumLinks bool
}

type TestSetup

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

TestSetup is a wrapper around a testing.M which handles setting up instance, client, VFSContext, testserver and cleaning up after itself

func NewSetup

func NewSetup(t testing.TB, name string) *TestSetup

NewSetup returns a new TestSetup name is used to prevent bug when tests are run in parallel

func (*TestSetup) GetTestAdminClient

func (c *TestSetup) GetTestAdminClient() (*oauth.Client, string)

GetTestAdminClient creates an oauth client and associated token with access to admin routes

func (*TestSetup) GetTestClient

func (c *TestSetup) GetTestClient(scopes string) (*oauth.Client, string)

GetTestClient creates an oauth client and associated token

func (*TestSetup) GetTestInstance

func (c *TestSetup) GetTestInstance(opts ...*lifecycle.Options) *instance.Instance

GetTestInstance creates an instance with a random host The instance will be removed on container cleanup

func (*TestSetup) GetTestServer

func (c *TestSetup) GetTestServer(prefix string, routes func(*echo.Group),
	mws ...func(*echo.Echo) *echo.Echo) *httptest.Server

GetTestServer start a testServer with a single group on prefix The server will be closed on container cleanup

func (*TestSetup) GetTestServerMultipleRoutes

func (c *TestSetup) GetTestServerMultipleRoutes(mpr map[string]func(*echo.Group), mws ...func(*echo.Echo) *echo.Echo) *httptest.Server

GetTestServerMultipleRoutes starts a testServer and creates a group for each pair of (prefix, routes) given. The server will be closed on container cleanup.

func (*TestSetup) InstallMiniApp

func (c *TestSetup) InstallMiniApp() (string, error)

func (*TestSetup) InstallMiniClientSideKonnector

func (c *TestSetup) InstallMiniClientSideKonnector() (string, error)

func (*TestSetup) InstallMiniKonnector

func (c *TestSetup) InstallMiniKonnector() (string, error)

func (*TestSetup) SetupSwiftTest

func (c *TestSetup) SetupSwiftTest()

SetupSwiftTest can be used to start an in-memory Swift server for tests.

Jump to

Keyboard shortcuts

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