[#189] sdk/netmap: Implement NodeInfo JSON encode/decode functions

Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
This commit is contained in:
Leonard Lyubich 2020-11-05 15:20:07 +03:00 committed by Alex Vanin
parent 8367b498d9
commit 40d7c9cd93
2 changed files with 31 additions and 0 deletions

View file

@ -140,3 +140,19 @@ func TestNodeInfo_Attributes(t *testing.T) {
require.Equal(t, as, i.Attributes())
}
func TestNodeInfoJSON(t *testing.T) {
i := NewNodeInfo()
i.SetPublicKey([]byte{1, 2, 3})
i.SetAddress("some node address")
i.SetState(NodeStateOnline)
i.SetAttributes(testNodeAttribute(), testNodeAttribute())
j, err := NodeInfoToJSON(i)
require.NoError(t, err)
i2, err := NodeInfoFromJSON(j)
require.NoError(t, err)
require.Equal(t, i, i2)
}