forked from TrueCloudLab/frostfs-api-go
[#168] object: Implement binary/JSON encoders/decoders on Attribute
Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
This commit is contained in:
parent
ce0d70fa02
commit
0caff85fb7
6 changed files with 103 additions and 4 deletions
|
@ -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)
|
||||
})
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue