[#505] event/container: Change number of items in SetEACL event

Change expected event items to 4 in order to support new binary session
token item. Parsing of the session token will be implemented later.

Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
This commit is contained in:
Leonard Lyubich 2021-05-25 17:41:20 +03:00 committed by Alex Vanin
parent 62281b91f4
commit 70f800eb76
2 changed files with 8 additions and 3 deletions

View file

@ -38,14 +38,18 @@ func (x SetEACL) PublicKey() []byte {
}
// ParseSetEACL parses SetEACL notification event from list of stack items.
//
// Expects 4 stack items.
func ParseSetEACL(items []stackitem.Item) (event.Event, error) {
var (
ev SetEACL
err error
)
if ln := len(items); ln != 3 {
return nil, event.WrongNumberOfParameters(3, ln)
const expectedItemNumEACL = 4
if ln := len(items); ln != expectedItemNumEACL {
return nil, event.WrongNumberOfParameters(expectedItemNumEACL, ln)
}
// parse table

View file

@ -23,7 +23,7 @@ func TestParseEACL(t *testing.T) {
}
_, err := container.ParseSetEACL(items)
require.EqualError(t, err, event.WrongNumberOfParameters(3, len(items)).Error())
require.EqualError(t, err, event.WrongNumberOfParameters(4, len(items)).Error())
})
t.Run("wrong container parameter", func(t *testing.T) {
@ -60,6 +60,7 @@ func TestParseEACL(t *testing.T) {
stackitem.NewByteArray(binaryTable),
stackitem.NewByteArray(signature),
stackitem.NewByteArray(publicKey),
stackitem.NewMap(),
})
require.NoError(t, err)