caddytest

package
v2.1.0-unotech Latest Latest
Warning

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

Go to latest
Published: Apr 12, 2020 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Default = Defaults{
	AdminPort:   2019,
	Certifcates: []string{"/caddy.localhost.crt", "/caddy.localhost.key"},
}

Default testing values

Functions

func AssertGetResponse

func AssertGetResponse(t *testing.T, requestURI string, statusCode int, expectedBody string) (*http.Response, string)

AssertGetResponse request a URI and assert the status code and the body contains a string

func AssertGetResponseBody

func AssertGetResponseBody(t *testing.T, requestURI string, expectedStatusCode int) (*http.Response, string)

AssertGetResponseBody request a URI and assert the status code matches

func AssertLoadError

func AssertLoadError(t *testing.T, rawConfig string, configType string, expectedError string)

AssertLoadError will load a config and expect an error

func AssertRedirect

func AssertRedirect(t *testing.T, requestURI string, expectedToLocation string, expectedStatusCode int) *http.Response

AssertRedirect makes a request and asserts the redirection happens

func InitServer

func InitServer(t *testing.T, rawConfig string, configType string)

InitServer this will configure the server with a configurion of a specific type. The configType must be either "json" or the adapter type.

Types

type Defaults

type Defaults struct {
	// Port we expect caddy to listening on
	AdminPort int
	// Certificates we expect to be loaded before attempting to run the tests
	Certifcates []string
}

Defaults store any configuration required to make the tests run

Jump to

Keyboard shortcuts

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