testutils

package
v1.0.4 Latest Latest
Warning

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

Go to latest
Published: Mar 20, 2019 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// Update flag will update .golden files to the current actual
	Update = flag.Bool("update", false, "update .golden files")
)

Functions

func GetTestServer

func GetTestServer(tls bool) (mux *http.ServeMux, teardown func())

GetTestServer creates a test server

func GetTestingEntity

func GetTestingEntity(t *testing.T, entityArgs ...string) (payload *integration.Integration, entity *integration.Entity)

GetTestingEntity creates an Entity used for testing

func GetTestingIntegration

func GetTestingIntegration(t *testing.T) (payload *integration.Integration)

GetTestingIntegration creates an Integration used for testing and sets the logger to the integration's logger

func ReadStructFromJSONFile

func ReadStructFromJSONFile(t *testing.T, filename string, object interface{})

ReadStructFromJSONFile Unmarshals the json file into the specified object

func ReadStructFromJSONString

func ReadStructFromJSONString(t *testing.T, rawJSON string, object interface{})

ReadStructFromJSONString reads a generic map[string]interface{} from a json string

Types

type TestLogger

type TestLogger struct {
	F func(format string, args ...interface{})
}

TestLogger a logger that logs to a generic format function, used with testing.T.Logf

func (*TestLogger) Debugf

func (l *TestLogger) Debugf(format string, args ...interface{})

Debugf debug format

func (*TestLogger) Errorf

func (l *TestLogger) Errorf(format string, args ...interface{})

Errorf error format

func (*TestLogger) Infof

func (l *TestLogger) Infof(format string, args ...interface{})

Infof info format

func (*TestLogger) Warnf

func (l *TestLogger) Warnf(format string, args ...interface{})

Warnf warning format

Jump to

Keyboard shortcuts

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