test

package
v0.0.0-...-98b9f36 Latest Latest
Warning

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

Go to latest
Published: Apr 29, 2019 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FailWith

func FailWith(statusCode int) http.Handler

FailWith is a test handler that fails

func Ping

func Ping(w http.ResponseWriter, r *http.Request)

Ping is a test handler

func Record

func Record(method string, url string, headers map[string]string, handleFunc http.Handler) (*httptest.ResponseRecorder, error)

Record creates a ResponseRecorder for testing

func RecoveryHandler

func RecoveryHandler(w http.ResponseWriter, r *http.Request, err interface{})

RecoveryHandler represents the recovery handler

Types

type Recipe

type Recipe struct {
	Name string `bson:"name" json:"name"`
	Tags []Tag  `bson:"tags" json:"tags"`
}

Recipe represents a hellofresh recipe

type Server

type Server struct {
	*httptest.Server
}

Server represents a testing HTTP Server

func NewServer

func NewServer(r router.Router) *Server

NewServer creates a new instance of Server

func (*Server) Do

func (s *Server) Do(method string, url string, headers map[string]string) (*http.Response, error)

Do creates a HTTP request to be tested

type Tag

type Tag string

Tag represents the recipe tags

Jump to

Keyboard shortcuts

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