frostfs-contract/tests/processing_test.go
Anton Nikiforov c9c53bb9ec
All checks were successful
DCO action / DCO (pull_request) Successful in 1m3s
Tests / Tests (1.19) (pull_request) Successful in 1m34s
Tests / Tests (1.20) (pull_request) Successful in 1m29s
[#17] frostfs: Remove method alphabetAddress
Signed-off-by: Anton Nikiforov <an.nikiforov@yadro.com>
2024-03-05 12:59:03 +03:00

53 lines
1.4 KiB
Go

package tests
import (
"path"
"testing"
"github.com/nspcc-dev/neo-go/pkg/core/native/nativenames"
"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"
"github.com/nspcc-dev/neo-go/pkg/wallet"
"github.com/stretchr/testify/require"
)
const processingPath = "../processing"
func deployProcessingContract(t *testing.T, e *neotest.Executor) util.Uint160 {
c := neotest.CompileFile(t, e.CommitteeHash, processingPath, path.Join(processingPath, "config.yml"))
e.DeployContract(t, c, nil)
return c.Hash
}
func newProcessingInvoker(t *testing.T) (*neotest.ContractInvoker, neotest.SingleSigner) {
e := newExecutor(t)
acc, err := wallet.NewAccount()
require.NoError(t, err)
sig := neotest.NewSingleSigner(acc)
gasHash, err := e.Chain.GetNativeContractScriptHash(nativenames.Gas)
require.NoError(t, err)
vc := e.CommitteeInvoker(gasHash).WithSigners(e.Validator)
vc.Invoke(t, true, "transfer",
e.Validator.ScriptHash(), sig.ScriptHash(),
int64(10_0000_0000), nil)
hash := deployProcessingContract(t, e)
return e.CommitteeInvoker(hash), sig
}
func TestVerify_Processing(t *testing.T) {
c, irMultiAcc := newProcessingInvoker(t)
const method = "verify"
cIR := c.WithSigners(irMultiAcc)
cIR.Invoke(t, stackitem.NewBool(false), method)
c.Invoke(t, stackitem.NewBool(true), method)
}