Documentation ¶
Index ¶
- func AssertJsonEqual(t *testing.T, expected, actual interface{}, msgAndArgs ...interface{}) bool
- func EmptyResponse() string
- func JsonCompact(jsonStr string) string
- func MockHTTPServer(requestChan chan *Request) *mockServer
- func RandServerAddress(t *testing.T) string
- func ReqChan() chan *Request
- func ReqToStr(t *testing.T, req *jsonrpc.RPCRequest) string
- func ResToStr(t *testing.T, res *jsonrpc.RPCResponse) string
- func StrToReq(t *testing.T, req string) *jsonrpc.RPCRequest
- func StrToRes(t *testing.T, res string) *jsonrpc.RPCResponse
- type Request
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AssertJsonEqual ¶ added in v0.13.3
assert.Equal for JSON - more accurate comparison, pretty diff
func EmptyResponse ¶ added in v0.13.5
func EmptyResponse() string
func JsonCompact ¶ added in v0.13.3
JsonCompact removes insignificant space characters from a JSON string It helps compare JSON strings without worrying about whitespace differences
func MockHTTPServer ¶ added in v0.13.3
func MockHTTPServer(requestChan chan *Request) *mockServer
MockHTTPServer creates an http server that can be used to test clients NOTE: if you want to make sure that you get requests in your requestChan one by one, limit the channel to a buffer size of 1. then writes to the chan will block until you read it. see ReqChan() for how to do this
func RandServerAddress ¶ added in v0.13.3
func ReqChan ¶ added in v0.13.3
func ReqChan() chan *Request
ReqChan makes a channel for reading received requests one by one. Use it in conjunction with MockHTTPServer
func ReqToStr ¶ added in v0.13.3
func ReqToStr(t *testing.T, req *jsonrpc.RPCRequest) string
ReqToStr stringifies a supplied RPCRequest
func ResToStr ¶ added in v0.13.3
func ResToStr(t *testing.T, res *jsonrpc.RPCResponse) string
ResToStr stringifies a supplied RPCResponse