testutil

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Mar 26, 2020 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package testutil contains helper functions for writing tests

Index

Constants

This section is empty.

Variables

View Source
var (

	// testutil.RootDir will point to wherever this project's root directory is located on the user's computer
	RootDir = filepath.Join(filepath.Dir(f), ".."+string(os.PathSeparator)+"..") + string(os.PathSeparator)
)

Functions

func ConvertResponseToRequest

func ConvertResponseToRequest(t *testing.T, w *httptest.ResponseRecorder) *http.Request

func Getenv

func Getenv(key string) string

func TestMiddlewares

func TestMiddlewares(t *testing.T, setup SetupFunc, test TestFunc, mws ...func(http.Handler) http.Handler)

Types

type Scaffold

type Scaffold struct {
	Setup func(*http.Request) *http.Request
	Test  func(*httptest.ResponseRecorder, *http.Request)
}

type SetupFunc

type SetupFunc func(*http.Request) *http.Request

type TestFunc

type TestFunc func(*httptest.ResponseRecorder, *http.Request)

Jump to

Keyboard shortcuts

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