[#168] object: Implement binary/JSON encoders/decoders on ShortHeader

Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
This commit is contained in:
Leonard Lyubich 2020-11-13 15:26:23 +03:00 committed by Alex Vanin
parent a684da6118
commit ce0d70fa02
4 changed files with 59 additions and 4 deletions

20
v2/object/json_test.go Normal file
View file

@ -0,0 +1,20 @@
package object_test
import (
"testing"
"github.com/nspcc-dev/neofs-api-go/v2/object"
"github.com/stretchr/testify/require"
)
func TestShortHeaderJSON(t *testing.T) {
h := generateShortHeader("id")
data, err := h.MarshalJSON()
require.NoError(t, err)
h2 := new(object.ShortHeader)
require.NoError(t, h2.UnmarshalJSON(data))
require.Equal(t, h, h2)
}