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

@ -18,3 +18,15 @@ func TestShortHeaderJSON(t *testing.T) {
require.Equal(t, h, h2)
}
func TestAttributeJSON(t *testing.T) {
a := generateAttribute("key", "value")
data, err := a.MarshalJSON()
require.NoError(t, err)
a2 := new(object.Attribute)
require.NoError(t, a2.UnmarshalJSON(data))
require.Equal(t, a, a2)
}