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

Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
This commit is contained in:
Leonard Lyubich 2020-11-13 14:48:19 +03:00 committed by Alex Vanin
parent 9ddc4c1f48
commit ae68790bbd
5 changed files with 106 additions and 5 deletions

View file

@ -156,17 +156,15 @@ func TestTargetInfo_StableMarshal(t *testing.T) {
func TestRecord_StableMarshal(t *testing.T) {
recordFrom := generateRecord(false)
transport := new(grpc.EACLRecord)
t.Run("non empty", func(t *testing.T) {
wire, err := recordFrom.StableMarshal(nil)
require.NoError(t, err)
err = goproto.Unmarshal(wire, transport)
require.NoError(t, err)
to := new(acl.Record)
require.NoError(t, to.Unmarshal(wire))
recordTo := acl.RecordFromGRPCMessage(transport)
require.Equal(t, recordFrom, recordTo)
require.Equal(t, recordFrom, to)
})
}