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

View file

@ -15,16 +15,14 @@ import (
func TestShortHeader_StableMarshal(t *testing.T) {
hdrFrom := generateShortHeader("Owner ID")
transport := new(grpc.ShortHeader)
t.Run("non empty", func(t *testing.T) {
wire, err := hdrFrom.StableMarshal(nil)
require.NoError(t, err)
err = goproto.Unmarshal(wire, transport)
require.NoError(t, err)
hdrTo := new(object.ShortHeader)
require.NoError(t, hdrTo.Unmarshal(wire))
hdrTo := object.ShortHeaderFromGRPCMessage(transport)
require.Equal(t, hdrFrom, hdrTo)
})
}