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: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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