[#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:
parent
62281b91f4
commit
70f800eb76
2 changed files with 8 additions and 3 deletions
|
@ -38,14 +38,18 @@ func (x SetEACL) PublicKey() []byte {
|
||||||
}
|
}
|
||||||
|
|
||||||
// ParseSetEACL parses SetEACL notification event from list of stack items.
|
// ParseSetEACL parses SetEACL notification event from list of stack items.
|
||||||
|
//
|
||||||
|
// Expects 4 stack items.
|
||||||
func ParseSetEACL(items []stackitem.Item) (event.Event, error) {
|
func ParseSetEACL(items []stackitem.Item) (event.Event, error) {
|
||||||
var (
|
var (
|
||||||
ev SetEACL
|
ev SetEACL
|
||||||
err error
|
err error
|
||||||
)
|
)
|
||||||
|
|
||||||
if ln := len(items); ln != 3 {
|
const expectedItemNumEACL = 4
|
||||||
return nil, event.WrongNumberOfParameters(3, ln)
|
|
||||||
|
if ln := len(items); ln != expectedItemNumEACL {
|
||||||
|
return nil, event.WrongNumberOfParameters(expectedItemNumEACL, ln)
|
||||||
}
|
}
|
||||||
|
|
||||||
// parse table
|
// parse table
|
||||||
|
|
|
@ -23,7 +23,7 @@ func TestParseEACL(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
_, err := container.ParseSetEACL(items)
|
_, 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) {
|
t.Run("wrong container parameter", func(t *testing.T) {
|
||||||
|
@ -60,6 +60,7 @@ func TestParseEACL(t *testing.T) {
|
||||||
stackitem.NewByteArray(binaryTable),
|
stackitem.NewByteArray(binaryTable),
|
||||||
stackitem.NewByteArray(signature),
|
stackitem.NewByteArray(signature),
|
||||||
stackitem.NewByteArray(publicKey),
|
stackitem.NewByteArray(publicKey),
|
||||||
|
stackitem.NewMap(),
|
||||||
})
|
})
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue