[#168] acl: Implement binary/JSON encoders/decoders on Target

Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
This commit is contained in:
Leonard Lyubich 2020-11-13 14:40:57 +03:00 committed by Alex Vanin
parent 7f42156201
commit 9ddc4c1f48
6 changed files with 127 additions and 4 deletions

View file

@ -76,3 +76,15 @@ func TestFilterJSON(t *testing.T) {
require.Equal(t, f, f2)
}
func TestTargetJSON(t *testing.T) {
tar := generateTarget(acl.RoleSystem, 3)
data, err := tar.MarshalJSON()
require.NoError(t, err)
tar2 := new(acl.Target)
require.NoError(t, tar2.UnmarshalJSON(data))
require.Equal(t, tar, tar2)
}