Documentation ¶
Index ¶
- func SetupFakeAPI(t *testing.T) (*http.ServeMux, string)
- func WriteJSONResponse(w http.ResponseWriter, body interface{}) error
- type EnvTest
- func (e *EnvTest) Apply(envVars map[string]string)
- func (e *EnvTest) ClearEnv()
- func (e *EnvTest) GetDomain() string
- func (e *EnvTest) GetValue(key string) string
- func (e *EnvTest) IsLiveTest() bool
- func (e *EnvTest) RestoreEnv()
- func (e *EnvTest) WithDomain(key string) *EnvTest
- func (e *EnvTest) WithLiveTestExtra(extra func() bool) *EnvTest
- func (e *EnvTest) WithLiveTestRequirements(keys ...string) *EnvTest
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func SetupFakeAPI ¶
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 (*EnvTest) Apply ¶
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 ¶
GetDomain Gets the domain value associated with the DNS challenge (linked to WithDomain method).
func (*EnvTest) IsLiveTest ¶
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 ¶
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 ¶
WithLiveTestExtra Allows to define an additional condition to flag a test as "live" test. This does not replace the default behavior.
func (*EnvTest) WithLiveTestRequirements ¶
WithLiveTestRequirements Defines the environment variables required to define a test as a "live" test. Replaces the default behavior (all keys are required).