[#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

@ -11,7 +11,6 @@ import (
func TestOwnerID_StableMarshal(t *testing.T) {
ownerFrom := new(refs.OwnerID)
ownerTransport := new(grpc.OwnerID)
t.Run("non empty", func(t *testing.T) {
ownerFrom.SetValue([]byte("Owner ID"))
@ -19,10 +18,9 @@ func TestOwnerID_StableMarshal(t *testing.T) {
wire, err := ownerFrom.StableMarshal(nil)
require.NoError(t, err)
err = goproto.Unmarshal(wire, ownerTransport)
require.NoError(t, err)
ownerTo := new(refs.OwnerID)
require.NoError(t, ownerTo.Unmarshal(wire))
ownerTo := refs.OwnerIDFromGRPCMessage(ownerTransport)
require.Equal(t, ownerFrom, ownerTo)
})
}