[#168] container: Implement binary/JSON encoders/decoders on Attribute
Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
This commit is contained in:
parent
ec957be60c
commit
bc5d9dcce5
4 changed files with 92 additions and 49 deletions
|
@ -14,16 +14,14 @@ import (
|
|||
|
||||
func TestAttribute_StableMarshal(t *testing.T) {
|
||||
attributeFrom := generateAttribute("key", "value")
|
||||
transport := new(grpc.Container_Attribute)
|
||||
|
||||
t.Run("non empty", func(t *testing.T) {
|
||||
wire, err := attributeFrom.StableMarshal(nil)
|
||||
require.NoError(t, err)
|
||||
|
||||
err = goproto.Unmarshal(wire, transport)
|
||||
require.NoError(t, err)
|
||||
attributeTo := new(container.Attribute)
|
||||
require.NoError(t, attributeTo.Unmarshal(wire))
|
||||
|
||||
attributeTo := container.AttributeFromGRPCMessage(transport)
|
||||
require.Equal(t, attributeFrom, attributeTo)
|
||||
})
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue