Documentation ¶
Overview ¶
Package testUtil has helpers to be used with unit tests
Index ¶
- func Assert(tb testing.TB, condition bool, msg string, v ...interface{})
- func CreateDeleteTestRequestServer(t *testing.T, expectedAuthTokenValue string, urlEndsWith string) *httptest.Server
- func CreateGetJSONTestRequestServer(t *testing.T, expectedAuthTokenValue string, jsonResponsePayload string, ...) *httptest.Server
- func CreateGetJsonTestServer(t *testing.T, expectedAuthToken string, jsonResponsePayload string, ...) *httptest.Server
- func CreatePostJSONTestRequestServer(t *testing.T, expectedAuthTokenValue string, outputResponseJSONPayload string, ...) *httptest.Server
- func Equals(tb testing.TB, exp, act interface{})
- func IsNil(tb testing.TB, act interface{})
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Assert ¶
Assert fails the test if the condition is false. Code was copied from https://github.com/benbjohnson/testing MIT license
func CreateDeleteTestRequestServer ¶
func CreateDeleteTestRequestServer(t *testing.T, expectedAuthTokenValue string, urlEndsWith string) *httptest.Server
CreateDeleteTestRequestServer creates a http.Server that can be used to test Delete requests.
func CreateGetJSONTestRequestServer ¶
func CreateGetJSONTestRequestServer(t *testing.T, expectedAuthTokenValue string, jsonResponsePayload string, verifyRequest func(*http.Request)) *httptest.Server
CreateGetJSONTestRequestServer creates a httptest.Server that can be used to test GetJson requests. Just specify the token, json payload that is to be read by the response, and a verification func that can be used to do additional validation of the request that is built
func CreateGetJsonTestServer ¶
func CreateGetJsonTestServer( t *testing.T, expectedAuthToken string, jsonResponsePayload string, verifyRequest func(*http.Request)) *httptest.Server
CreateGetJSONTestServer creates a httptest.Server that can be used to test JSON Get requests. Takes a token, JSON payload, and a verification function to do additional validation
func CreatePostJSONTestRequestServer ¶
func CreatePostJSONTestRequestServer(t *testing.T, expectedAuthTokenValue string, outputResponseJSONPayload string, expectedRequestURLEndsWith string, expectedRequestBody string) *httptest.Server
CreatePostJSONTestRequestServer creates a http.Server that can be used to test PostJson requests. Specify the token, response json payload and the url and request body that is expected.
func Equals ¶
Equals fails the test if exp is not equal to act. Code was copied from https://github.com/benbjohnson/testing MIT license
Types ¶
This section is empty.