[#168] container: 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:14:39 +03:00 committed by Alex Vanin
parent ec957be60c
commit bc5d9dcce5
4 changed files with 92 additions and 49 deletions

View file

@ -28,3 +28,15 @@ func TestContainerJSON(t *testing.T) {
require.Error(t, err)
})
}
func TestAttributeJSON(t *testing.T) {
b := generateAttribute("key", "value")
data, err := b.MarshalJSON()
require.NoError(t, err)
b2 := new(container.Attribute)
require.NoError(t, b2.UnmarshalJSON(data))
require.Equal(t, b, b2)
}