Documentation ¶
Index ¶
- func Compare(t *testing.T, expected []string, alertsStrs []string)
- func CreateV3Session(t *testing.T, TrafficOpsURL string, username string, password string, ...) *v3client.Session
- func CreateV4Session(t *testing.T, TrafficOpsURL string, username string, password string, ...) *v4client.Session
- func ErrorsToStrings(errs []error) []string
- func FindNeedle(needle string, haystack []string) bool
- type CkReqFunc
- type ErrorAndMessage
- type V3TestCase
- type V3TestData
- type V4TestCase
- type V4TestData
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CreateV3Session ¶
func CreateV3Session(t *testing.T, TrafficOpsURL string, username string, password string, toReqTimeout int) *v3client.Session
CreateV3Session creates a session for client v4 using the passed in username and password.
func CreateV4Session ¶
func CreateV4Session(t *testing.T, TrafficOpsURL string, username string, password string, toReqTimeout int) *v4client.Session
CreateV4Session creates a session for client v4 using the passed in username and password.
func ErrorsToStrings ¶
func FindNeedle ¶
Types ¶
type CkReqFunc ¶
type CkReqFunc func(*testing.T, toclientlib.ReqInf, interface{}, tc.Alerts, error)
CkReqFunc defines the reusable signature for all other functions that perform checks. Common parameters that are checked include the request's info, response, alerts, and errors.
func CkRequest ¶
CkRequest wraps CkReqFunc functions, to be concise and reduce lexical tokens i.e. Instead of `[]CkReqFunc {` we can use `CkRequest(` in test case declarations.
func HasError ¶
func HasError() CkReqFunc
HasError checks that an error was returned (i.e. not `nil`).
func ResponseHasLength ¶
ResponseHasLength checks that the length of the response is as expected. Determines that response is a slice before checking the length of the reflected value.
func ResponseLengthGreaterOrEqual ¶
ResponseLengthGreaterOrEqual checks that the response is greater or equal to the expected length. Determines that response is a slice before checking the length of the reflected value.
type ErrorAndMessage ¶
type V3TestCase ¶
type V3TestCase map[string]map[string]V3TestData
V3TestCase is the type of the V3TestData struct. Uses nested map to represent the method being tested and the test's description.
type V3TestData ¶
type V3TestData struct { EndpointId func() int ClientSession *v3client.Session RequestParams url.Values RequestHeaders http.Header RequestBody map[string]interface{} Expectations []CkReqFunc }
V3TestData represents the data needed for testing the v3 api endpoints.
type V4TestCase ¶
type V4TestCase map[string]map[string]V4TestData
V4TestCase is the type of the V4TestData struct. Uses nested map to represent the method being tested and the test's description.
type V4TestData ¶
type V4TestData struct { EndpointId func() int ClientSession *v4client.Session RequestOpts v4client.RequestOptions RequestBody map[string]interface{} Expectations []CkReqFunc }
V4TestData represents the data needed for testing the v4 api endpoints.