Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rpc: add testing to RPC client package #763

Merged
merged 5 commits into from
Mar 24, 2020
Merged

Conversation

AnnaShaleva
Copy link
Member

@AnnaShaleva AnnaShaleva commented Mar 16, 2020

closes #716

Minor bug fixes for json marshalling of the following fields:

  • result.Header.NextConsensus
  • result.ContractState.Script
  • result.NEP5Balances.Balances
  • result.Validator.PublicKey

@AnnaShaleva AnnaShaleva added rpc RPC server and client test Unit tests labels Mar 16, 2020
@AnnaShaleva AnnaShaleva self-assigned this Mar 16, 2020
@codecov
Copy link

codecov bot commented Mar 16, 2020

Codecov Report

Merging #763 into master will increase coverage by 2.4%.
The diff coverage is 21.81%.

Impacted file tree graph

@@            Coverage Diff            @@
##           master     #763     +/-   ##
=========================================
+ Coverage   64.54%   66.94%   +2.4%     
=========================================
  Files         141      141             
  Lines       12980    13034     +54     
=========================================
+ Hits         8378     8726    +348     
+ Misses       4200     3898    -302     
- Partials      402      410      +8
Impacted Files Coverage Δ
pkg/rpc/response/result/nep5.go 0% <ø> (ø) ⬆️
pkg/rpc/response/result/contract_state.go 0% <0%> (ø) ⬆️
pkg/rpc/response/result/block_header.go 0% <0%> (ø) ⬆️
pkg/crypto/keys/publickey.go 83.92% <85.71%> (+0.16%) ⬆️
pkg/rpc/client/client.go 43.8% <0%> (+43.8%) ⬆️
pkg/rpc/client/rpc.go 85.54% <0%> (+85.54%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 751e79d...6998c50. Read the comment docs.

@AnnaShaleva AnnaShaleva force-pushed the feature/rpc_client_tests branch 2 times, most recently from 219b185 to e381358 Compare March 18, 2020 11:06
@AnnaShaleva AnnaShaleva force-pushed the feature/rpc_client_tests branch 3 times, most recently from f9c0d36 to 68d2a39 Compare March 18, 2020 14:56
@AnnaShaleva AnnaShaleva marked this pull request as ready for review March 18, 2020 15:03
@AnnaShaleva AnnaShaleva force-pushed the feature/rpc_client_tests branch 2 times, most recently from 87816fc to 58c3dac Compare March 18, 2020 15:19
pkg/rpc/response/result/validator.go Outdated Show resolved Hide resolved
pkg/rpc/response/result/contract_state.go Outdated Show resolved Hide resolved
@AnnaShaleva AnnaShaleva force-pushed the feature/rpc_client_tests branch 6 times, most recently from ffead2c to 4c18262 Compare March 22, 2020 15:46
Problem: wrong json marshalling of `nextconsensus` field of
result.Header

Solution: change field type from util.uint160 to address string
problem: `script` field of result.ContractState is marshalled as []byte

solution: add marshaller for result.ContractState
Problem: wrong json field name of result.NEP5Balances.Balances
(see for details:
https://github.com/neo-project/neo-modules/blob/master-2.x/RpcNep5Tracker/RpcNep5Tracker.cs#L295)

Solution: rename field from `balances` to `balance` to be consistent with C# client
Copy link
Member

@roman-khimov roman-khimov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just some nitpicking, looks good in general.

pkg/rpc/response/result/validator.go Outdated Show resolved Hide resolved
pkg/rpc/client/rpc_test.go Outdated Show resolved Hide resolved
pkg/rpc/client/rpc_test.go Outdated Show resolved Hide resolved
pkg/rpc/client/rpc_test.go Outdated Show resolved Hide resolved
pkg/rpc/client/rpc_test.go Outdated Show resolved Hide resolved
pkg/rpc/client/rpc_test.go Show resolved Hide resolved
Problem: wrong `PublicKey` field json marshalling of result.Validator

Solution: add marshaller to publickey (crypto)
closes #716

NOTE: RPC client tests contain `serverResponse` json data fetched from examples
published in official C# JSON-RPC API v2.10.3 reference
(see https://docs.neo.org/docs/en-us/reference/rpc/latest-version/api.html)
@roman-khimov roman-khimov merged commit 6ba2190 into master Mar 24, 2020
@roman-khimov roman-khimov deleted the feature/rpc_client_tests branch March 24, 2020 13:07
@roman-khimov roman-khimov mentioned this pull request Apr 9, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
rpc RPC server and client test Unit tests
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add testing to RPC client package
3 participants