forked from TrueCloudLab/frostfs-node
[#825] event/notaryPreparator: Add unit test for incorrect Main TX script
Signed-off-by: Pavel Karpy <carpawell@nspcc.ru>
This commit is contained in:
parent
1b4f8f7e9f
commit
7a15e649ba
1 changed files with 39 additions and 0 deletions
|
@ -60,6 +60,45 @@ func (b blockCounter) BlockCount() (res uint32, err error) {
|
||||||
return b.epoch, b.err
|
return b.epoch, b.err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func TestPrepare_IncorrectScript(t *testing.T) {
|
||||||
|
preparator := notaryPreparator(
|
||||||
|
PreparatorPrm{
|
||||||
|
alphaKeysSource(),
|
||||||
|
blockCounter{100, nil},
|
||||||
|
},
|
||||||
|
)
|
||||||
|
|
||||||
|
t.Run("not contract call", func(t *testing.T) {
|
||||||
|
bw := io.NewBufBinWriter()
|
||||||
|
|
||||||
|
emit.Int(bw.BinWriter, 4)
|
||||||
|
emit.String(bw.BinWriter, "test")
|
||||||
|
emit.Bytes(bw.BinWriter, scriptHash.BytesBE())
|
||||||
|
emit.Syscall(bw.BinWriter, interopnames.SystemCallbackInvoke)
|
||||||
|
|
||||||
|
nr := correctNR(bw.Bytes())
|
||||||
|
|
||||||
|
_, err := preparator.Prepare(nr)
|
||||||
|
|
||||||
|
require.EqualError(t, err, errNotContractCall.Error())
|
||||||
|
})
|
||||||
|
|
||||||
|
t.Run("incorrect ", func(t *testing.T) {
|
||||||
|
bw := io.NewBufBinWriter()
|
||||||
|
|
||||||
|
emit.Int(bw.BinWriter, -1)
|
||||||
|
emit.String(bw.BinWriter, "test")
|
||||||
|
emit.Bytes(bw.BinWriter, scriptHash.BytesBE())
|
||||||
|
emit.Syscall(bw.BinWriter, interopnames.SystemContractCall)
|
||||||
|
|
||||||
|
nr := correctNR(bw.Bytes())
|
||||||
|
|
||||||
|
_, err := preparator.Prepare(nr)
|
||||||
|
|
||||||
|
require.EqualError(t, err, errIncorrectCallFlag.Error())
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
func TestPrepare_IncorrectNR(t *testing.T) {
|
func TestPrepare_IncorrectNR(t *testing.T) {
|
||||||
type (
|
type (
|
||||||
mTX struct {
|
mTX struct {
|
||||||
|
|
Loading…
Reference in a new issue