Documentation
¶
Index ¶
- func AssertJsonEqual(t *testing.T, expected, actual interface{}, msgAndArgs ...interface{}) bool
- func EmptyResponse() string
- func JsonCompact(jsonStr string) string
- 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
- type MockServer
- 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 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 is a convenience method
Types ¶
type MockServer ¶ added in v0.13.3
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 (*MockServer) QueueResponses ¶ added in v0.13.5
func (m *MockServer) QueueResponses(responses ...string)
Click to show internal directories.
Click to hide internal directories.