itgmtod

package module
v0.0.0-...-210daab Latest Latest
Warning

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

Go to latest
Published: Dec 2, 2021 License: GPL-3.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (

	// BackCyan is used by AUTH
	BackCyan = color.New(color.BgCyan).Add(color.FgBlack).SprintfFunc()
	// BackBlue is used by USER
	BackBlue = color.New(color.BgBlue).Add(color.FgWhite).SprintfFunc()
	// BackMagenta is used by LIBRARY
	BackMagenta = color.New(color.BgMagenta).Add(color.FgWhite).SprintfFunc()
)

Functions

func CheckExpectedResponse

func CheckExpectedResponse(res *http.Response, expected interface{}) error

CheckExpectedResponse will read and unmarshall the response body and then call StructContain

func JoinURL

func JoinURL(base string, paths ...string) string

JoinURL Join a base url with a route path

func MarshallBody

func MarshallBody(body interface{}) ([]byte, error)

MarshallBody is used to get the JSON bytes out of a struct

func NewFailureMessage

func NewFailureMessage(MS string, verb string, route string, testSuite string, errMessage string)

NewFailureMessage print a failure message for an integration Test

func NewSuccessMessage

func NewSuccessMessage(MS string, verb string, route string, testSuite string)

NewSuccessMessage print a success message for an integration Test

func RandStringRunes

func RandStringRunes(length int) string

RandStringRunes generate a random string of specified length

func StructContain

func StructContain(x, y interface{}) bool

StructContain compare 2 struct interfaces. If the non-empty data of the y interface are the same as the one in the x interface, true is returned. Otherwise false

func TestRoute

func TestRoute(HTTPMethod string, URL string, authJWT *string, body io.Reader, expectedHTTPCode int) (*http.Response, error)

TestRoute create and call an HTTP route with the given parameters. In case of error, an error is returned. The response object is returned in case of success.

Types

This section is empty.

Jump to

Keyboard shortcuts

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