Documentation ¶
Index ¶
- Variables
- func CheckExpectedResponse(res *http.Response, expected interface{}) error
- func JoinURL(base string, paths ...string) string
- func MarshallBody(body interface{}) ([]byte, error)
- func NewFailureMessage(MS string, verb string, route string, testSuite string, errMessage string)
- func NewSuccessMessage(MS string, verb string, route string, testSuite string)
- func RandStringRunes(length int) string
- func StructContain(x, y interface{}) bool
- func TestRoute(HTTPMethod string, URL string, authJWT *string, body io.Reader, ...) (*http.Response, error)
Constants ¶
This section is empty.
Variables ¶
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 ¶
CheckExpectedResponse will read and unmarshall the response body and then call StructContain
func MarshallBody ¶
MarshallBody is used to get the JSON bytes out of a struct
func NewFailureMessage ¶
NewFailureMessage print a failure message for an integration Test
func NewSuccessMessage ¶
NewSuccessMessage print a success message for an integration Test
func RandStringRunes ¶
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.