testutil

package
v0.31.0 Latest Latest
Warning

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

Go to latest
Published: Jun 17, 2021 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Overview

Package testutil provides helpers for unit tests.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AssertBool

func AssertBool(t *testing.T, want, have bool)

AssertBool fatals a test if the parameters aren't equal.

func AssertEqual added in v0.9.0

func AssertEqual(t *testing.T, want, have interface{})

AssertEqual fatals a test if the parameters aren't equal.

func AssertErrorContains

func AssertErrorContains(t *testing.T, err error, target string)

AssertErrorContains fatals a test if the error's Error string doesn't contain target. As a special case, if target is the empty string, we assume the error should be nil.

func AssertNoError

func AssertNoError(t *testing.T, err error)

AssertNoError fatals a test if the error is not nil.

func AssertRemediationErrorContains added in v0.8.0

func AssertRemediationErrorContains(t *testing.T, err error, target string)

AssertRemediationErrorContains fatals a test if the error's RemediationError remediation string doesn't contain target. As a special case, if target is the empty string, we assume the error should be nil.

func AssertString

func AssertString(t *testing.T, want, have string)

AssertString fatals a test if the parameters aren't equal.

func AssertStringContains

func AssertStringContains(t *testing.T, s, substr string)

AssertStringContains fatals a test if the string doesn't contain a substring.

func CloneVersionError added in v0.31.0

func CloneVersionError(i *fastly.CloneVersionInput) (*fastly.Version, error)

CloneVersionError returns a generic error message when attempting to clone a service version.

func CloneVersionResult added in v0.31.0

func CloneVersionResult(version int) func(i *fastly.CloneVersionInput) (*fastly.Version, error)

CloneVersionResult returns a function which returns a specific cloned version.

func ListVersions added in v0.31.0

func ListVersions(i *fastly.ListVersionsInput) ([]*fastly.Version, error)

ListVersions returns a list of service versions in different states.

The first element is active, the second is locked, the third is editable.

NOTE: consult the entire test suite before adding any new entries to the returned type as the tests currently use testutil.CloneVersionResult() as a way of making the test output and expectations as accurate as possible.

func ListVersionsError added in v0.31.0

func ListVersionsError(i *fastly.ListVersionsInput) ([]*fastly.Version, error)

ListVersionsError returns a generic error message when attempting to list service versions.

func MakeTempFile added in v0.21.0

func MakeTempFile(t *testing.T, contents string) string

MakeTempFile creates a tempfile with the given contents and returns its path

func MustParseTimeRFC3339

func MustParseTimeRFC3339(s string) *time.Time

MustParseTimeRFC3339 is a small helper to initialize time constants.

Types

This section is empty.

Jump to

Keyboard shortcuts

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