frostfs-contract/tests/processing_test.go
Pavel Karpy 9b50e1bb88 [#192] processing: Add processing contract test
Signed-off-by: Pavel Karpy <carpawell@nspcc.ru>
2021-12-07 11:28:51 +03:00

40 lines
1 KiB
Go

package tests
import (
"path"
"testing"
"github.com/nspcc-dev/neo-go/pkg/neotest"
"github.com/nspcc-dev/neo-go/pkg/util"
"github.com/nspcc-dev/neo-go/pkg/vm/stackitem"
)
const processingPath = "../processing"
func deployProcessingContract(t *testing.T, e *neotest.Executor, addrNeoFS util.Uint160) util.Uint160 {
c := neotest.CompileFile(t, e.CommitteeHash, processingPath, path.Join(processingPath, "config.yml"))
args := make([]interface{}, 1)
args[0] = addrNeoFS
e.DeployContract(t, c, args)
return c.Hash
}
func newProcessingInvoker(t *testing.T) (*neotest.ContractInvoker, neotest.Signer) {
neofsInvoker, irMultiAcc, _ := newNeoFSInvoker(t, 2)
hash := deployProcessingContract(t, neofsInvoker.Executor, neofsInvoker.Hash)
return neofsInvoker.CommitteeInvoker(hash), irMultiAcc
}
func TestVerify_Processing(t *testing.T) {
c, irMultiAcc := newProcessingInvoker(t)
const method = "verify"
cIR := c.WithSigners(irMultiAcc)
cIR.Invoke(t, stackitem.NewBool(true), method)
c.Invoke(t, stackitem.NewBool(false), method)
}