diff options
author | Bas van Kervel <bas@ethdev.com> | 2015-07-03 22:57:40 +0800 |
---|---|---|
committer | Bas van Kervel <bas@ethdev.com> | 2015-07-03 22:57:40 +0800 |
commit | e8c1399bbf08234389f0e8f5da08f146856dab12 (patch) | |
tree | 0264d40c0b540f99533e3ed24b3d2d55825825f8 /rpc | |
parent | d9efaf754c54b5a66f03c68a0c04fbad050e9370 (diff) | |
download | go-tangerine-e8c1399bbf08234389f0e8f5da08f146856dab12.tar go-tangerine-e8c1399bbf08234389f0e8f5da08f146856dab12.tar.gz go-tangerine-e8c1399bbf08234389f0e8f5da08f146856dab12.tar.bz2 go-tangerine-e8c1399bbf08234389f0e8f5da08f146856dab12.tar.lz go-tangerine-e8c1399bbf08234389f0e8f5da08f146856dab12.tar.xz go-tangerine-e8c1399bbf08234389f0e8f5da08f146856dab12.tar.zst go-tangerine-e8c1399bbf08234389f0e8f5da08f146856dab12.zip |
fixed unittest after new implementation
Diffstat (limited to 'rpc')
-rw-r--r-- | rpc/codec/json_test.go | 38 |
1 files changed, 1 insertions, 37 deletions
diff --git a/rpc/codec/json_test.go b/rpc/codec/json_test.go index 60cac05f7..d5c672cdf 100644 --- a/rpc/codec/json_test.go +++ b/rpc/codec/json_test.go @@ -112,42 +112,6 @@ func TestJsonDecoderWithValidBatchRequest(t *testing.T) { } } -func TestJsonDecoderWithIncompleteMessage(t *testing.T) { - reqdata := []byte(`{"jsonrpc":"2.0","method":"modules","pa`) - decoder := newJsonTestConn(reqdata) - - jsonDecoder := NewJsonCoder(decoder) - requests, batch, err := jsonDecoder.ReadRequest() - - if err != io.EOF { - t.Errorf("Expected to read an incomplete request err but got %v", err) - } - - // remaining message - decoder.Write([]byte(`rams":[],"id":64}`)) - requests, batch, err = jsonDecoder.ReadRequest() - - if err != nil { - t.Errorf("Read valid request failed - %v", err) - } - - if len(requests) != 1 { - t.Errorf("Expected to get a single request but got %d", len(requests)) - } - - if batch { - t.Errorf("Got batch indication while expecting single request") - } - - if requests[0].Id != float64(64) { - t.Errorf("Expected req.Id == 64 but got %v", requests[0].Id) - } - - if requests[0].Method != "modules" { - t.Errorf("Expected req.Method == 'modules' got '%s'", requests[0].Method) - } -} - func TestJsonDecoderWithInvalidIncompleteMessage(t *testing.T) { reqdata := []byte(`{"jsonrpc":"2.0","method":"modules","pa`) decoder := newJsonTestConn(reqdata) @@ -155,7 +119,7 @@ func TestJsonDecoderWithInvalidIncompleteMessage(t *testing.T) { jsonDecoder := NewJsonCoder(decoder) requests, batch, err := jsonDecoder.ReadRequest() - if err != io.EOF { + if err != io.ErrUnexpectedEOF { t.Errorf("Expected to read an incomplete request err but got %v", err) } |