tester

package
v2.5.0+incompatible Latest Latest
Warning

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

Go to latest
Published: Apr 18, 2019 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SetupFakeAPI

func SetupFakeAPI() (*http.ServeMux, string, func())

SetupFakeAPI Minimal stub ACME server for validation.

func WriteJSONResponse

func WriteJSONResponse(w http.ResponseWriter, body interface{}) error

WriteJSONResponse marshals the body as JSON and writes it to the response.

Types

type EnvTest

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

EnvTest Environment variables manager for tests.

func NewEnvTest

func NewEnvTest(keys ...string) *EnvTest

NewEnvTest Creates an EnvTest.

func (*EnvTest) Apply

func (e *EnvTest) Apply(envVars map[string]string)

Apply Sets/Unsets environment variables. Not related to the main environment variables.

func (*EnvTest) ClearEnv

func (e *EnvTest) ClearEnv()

ClearEnv Deletes all environment variables related to the test.

func (*EnvTest) GetDomain

func (e *EnvTest) GetDomain() string

GetDomain Gets the domain value associated with the DNS challenge (linked to WithDomain method).

func (*EnvTest) GetValue

func (e *EnvTest) GetValue(key string) string

GetValue Gets the stored value of an environment variable.

func (*EnvTest) IsLiveTest

func (e *EnvTest) IsLiveTest() bool

IsLiveTest Checks whether environment variables allow running a "live" test.

func (*EnvTest) RestoreEnv

func (e *EnvTest) RestoreEnv()

RestoreEnv Restores the environment variables to the initial state.

func (*EnvTest) WithDomain

func (e *EnvTest) WithDomain(key string) *EnvTest

WithDomain Defines the name of the environment variable used to define the domain related to the DNS request. If the domain is defined, it was considered mandatory to define a test as a "live" test.

func (*EnvTest) WithLiveTestExtra

func (e *EnvTest) WithLiveTestExtra(extra func() bool) *EnvTest

WithLiveTestExtra Allows to define an additional condition to flag a test as "live" test. This does not replace the default behavior.

func (*EnvTest) WithLiveTestRequirements

func (e *EnvTest) WithLiveTestRequirements(keys ...string) *EnvTest

WithLiveTestRequirements Defines the environment variables required to define a test as a "live" test. Replaces the default behavior (all keys are required).

Jump to

Keyboard shortcuts

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