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

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

View file

@ -29,16 +29,14 @@ func TestShortHeader_StableMarshal(t *testing.T) {
func TestAttribute_StableMarshal(t *testing.T) {
from := generateAttribute("Key", "Value")
transport := new(grpc.Header_Attribute)
t.Run("non empty", func(t *testing.T) {
wire, err := from.StableMarshal(nil)
require.NoError(t, err)
err = goproto.Unmarshal(wire, transport)
require.NoError(t, err)
to := new(object.Attribute)
require.NoError(t, to.Unmarshal(wire))
to := object.AttributeFromGRPCMessage(transport)
require.Equal(t, from, to)
})
}