forked from TrueCloudLab/frostfs-node
[#505] event/container: Change number of items in Put 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
ac2d347884
commit
f2778361c8
2 changed files with 6 additions and 3 deletions
|
@ -15,6 +15,8 @@ type Put struct {
|
|||
publicKey []byte
|
||||
}
|
||||
|
||||
const expectedItemNumPut = 4
|
||||
|
||||
// MorphEvent implements Neo:Morph Event interface.
|
||||
func (Put) MorphEvent() {}
|
||||
|
||||
|
@ -34,8 +36,8 @@ func ParsePut(params []stackitem.Item) (event.Event, error) {
|
|||
err error
|
||||
)
|
||||
|
||||
if ln := len(params); ln != 3 {
|
||||
return nil, event.WrongNumberOfParameters(3, ln)
|
||||
if ln := len(params); ln != expectedItemNumPut {
|
||||
return nil, event.WrongNumberOfParameters(expectedItemNumPut, ln)
|
||||
}
|
||||
|
||||
// parse container
|
||||
|
|
|
@ -22,7 +22,7 @@ func TestParsePut(t *testing.T) {
|
|||
}
|
||||
|
||||
_, err := ParsePut(prms)
|
||||
require.EqualError(t, err, event.WrongNumberOfParameters(3, len(prms)).Error())
|
||||
require.EqualError(t, err, event.WrongNumberOfParameters(expectedItemNumPut, len(prms)).Error())
|
||||
})
|
||||
|
||||
t.Run("wrong container parameter", func(t *testing.T) {
|
||||
|
@ -57,6 +57,7 @@ func TestParsePut(t *testing.T) {
|
|||
stackitem.NewByteArray(containerData),
|
||||
stackitem.NewByteArray(signature),
|
||||
stackitem.NewByteArray(publicKey),
|
||||
stackitem.NewMap(),
|
||||
})
|
||||
require.NoError(t, err)
|
||||
|
||||
|
|
Loading…
Reference in a new issue