Documentation ¶
Index ¶
- func Fatal(msg ...interface{})
- func NeedCouchdb()
- func TODO(t *testing.T, date string, args ...interface{})
- type CookieJar
- type TestSetup
- func (c *TestSetup) AddCleanup(f func() error)
- func (c *TestSetup) Cleanup()
- func (c *TestSetup) CleanupAndDie(msg ...interface{})
- func (c *TestSetup) GetCookieJar() http.CookieJar
- func (c *TestSetup) GetTestClient(scopes string) (*oauth.Client, string)
- func (c *TestSetup) GetTestInstance(opts ...*lifecycle.Options) *instance.Instance
- func (c *TestSetup) GetTestServer(prefix string, routes func(*echo.Group), mws ...func(*echo.Echo) *echo.Echo) *httptest.Server
- func (c *TestSetup) GetTestServerMultipleRoutes(mpr map[string]func(*echo.Group), mws ...func(*echo.Echo) *echo.Echo) *httptest.Server
- func (c *TestSetup) GetTmpDirectory() string
- func (c *TestSetup) Run() int
- func (c *TestSetup) SetupSwiftTest() error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type CookieJar ¶
CookieJar is a http.CookieJar which always returns all cookies. NOTE golang stdlib uses cookies for the URL (ie the testserver), not for the host (ie the instance), so we do it manually
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 ¶
NewSetup returns a new TestSetup name is used to prevent bug when tests are run in parallel
func (*TestSetup) AddCleanup ¶
AddCleanup adds a function to be run when the test is finished.
func (*TestSetup) CleanupAndDie ¶
func (c *TestSetup) CleanupAndDie(msg ...interface{})
CleanupAndDie cleanup the TestSetup, prints a message and close the process
func (*TestSetup) GetCookieJar ¶
GetCookieJar returns a cookie jar valable for test the jar discard the url passed to Cookies and SetCookies and always use the setup instance URL instead.
func (*TestSetup) GetTestClient ¶
GetTestClient creates an oauth client and associated token
func (*TestSetup) GetTestInstance ¶
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) GetTmpDirectory ¶
GetTmpDirectory creates a temporary directory The directory will be removed on container cleanup
func (*TestSetup) SetupSwiftTest ¶
SetupSwiftTest can be used to start an in-memory Swift server for tests.