[#168] refs: Implement binary/JSON encoders/decoders on OwnerID

Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
This commit is contained in:
Leonard Lyubich 2020-11-13 16:14:00 +03:00 committed by Alex Vanin
parent c0f3ac51d4
commit 9ec57ee9f8
6 changed files with 110 additions and 6 deletions

View file

@ -44,3 +44,16 @@ func TestContainerIDJSON(t *testing.T) {
require.Equal(t, cid, cid2)
}
func TestOwnerIDJSON(t *testing.T) {
o := new(refs.OwnerID)
o.SetValue([]byte{1})
data, err := o.MarshalJSON()
require.NoError(t, err)
o2 := new(refs.OwnerID)
require.NoError(t, o2.UnmarshalJSON(data))
require.Equal(t, o, o2)
}