Documentation ¶
Overview ¶
Package testutil provides utilities for testing.
Index ¶
- Constants
- func ReadFile(t *testing.T, name string) (file []byte)
- func SetupClient() (client *bunnystorage.Client, err error)
- func SetupFile(t *testing.T) (name string, size int64, err error)
- func SetupMockClient(t *testing.T) *bunnystorage.Client
- func SetupMockServer(t *testing.T) (mux *http.ServeMux, teardown func())
Constants ¶
View Source
const ( // ErrMissingEnvVar is returned when an environment variable is missing. ErrMissingEnvVar xerrors.Error = "missing environment variable" // ErrTestClient is returned when the test client fails to initialize. ErrTestClient xerrors.Error = "failed to initialize test client" )
View Source
const MockServerAddr string = "localhost:62769"
MockServerAddr is the address of the mock server.
Variables ¶
This section is empty.
Functions ¶
func ReadFile ¶ added in v0.3.0
ReadFile reads the named file and either returns its contents or fails the test.
func SetupClient ¶
func SetupClient() (client *bunnystorage.Client, err error)
SetupClient sets up a test client for integration tests.
The following environment variables are required: - BUNNY_STORAGE_ZONE - BUNNY_READ_API_KEY - BUNNY_WRITE_API_KEY
The test will fail if any of them are empty or not set.
func SetupMockClient ¶ added in v0.3.0
SetupMockClient sets up a mock client for mocking tests.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.