test_utils

package
v1.16.0 Latest Latest
Warning

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

Go to latest
Published: Mar 7, 2024 License: GPL-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var TestClient = TestServer.Client()
View Source
var TestServer = go_test_utils.NewTestServer(go_test_utils.Routes{
	"/api/v1/session": func(w *http.ResponseWriter, r *http.Request) {
		(*w).Write([]byte("{\"token\": \"mock\"}"))
	},
	"/api/v1/session/authenticate": func(w *http.ResponseWriter, r *http.Request) {
		(*w).Write([]byte("{\"authenticated\": \"true\"}"))
	},
	"/api/v1/settings/purge": func(w *http.ResponseWriter, r *http.Request) {
		(*w).WriteHeader(500)
	},
	"/api/v1/mock": func(w *http.ResponseWriter, r *http.Request) {
		(*w).Write([]byte("{\"mocked\": \"true\"}"))
	},
})

Functions

func AssertJsonStringEquals added in v0.90.0

func AssertJsonStringEquals(t testing.TB, expected, got string)

AssertJsonStringEquals checks if two json strings are equal when minified

func AssertLoggingEqualsRegex

func AssertLoggingEqualsRegex(log bytes.Buffer, want []LoggingRegexAssertion) (bool, []string)

Types

type LoggingMessage

type LoggingMessage struct {
	Level string
	Msg   string
}

type LoggingRegexAssertion

type LoggingRegexAssertion struct {
	Level    string
	MsgRegex *regexp.Regexp
}

func (LoggingRegexAssertion) String

func (assertion LoggingRegexAssertion) String() string

type LoggingRegexAssertions

type LoggingRegexAssertions []LoggingRegexAssertion

func (LoggingRegexAssertions) String

func (assertions LoggingRegexAssertions) String() string

Jump to

Keyboard shortcuts

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