Revert "[#198] test: Adopt neotest changes"

This reverts commit 17907f9457.
This commit is contained in:
Alex Vanin 2022-01-13 15:02:54 +03:00 committed by Alex Vanin
parent 24d24b9db7
commit 8418183498

View file

@ -18,6 +18,11 @@ import (
const alphabetPath = "../alphabet" const alphabetPath = "../alphabet"
// FIXME: delete after https://github.com/nspcc-dev/neo-go/issues/2297
const singleValidatorWIF = "KxyjQ8eUa4FHt3Gvioyt1Wz29cTUrE4eTqX3yFSk1YFCsPL8uNsY"
var committeeAcc, _ = wallet.NewAccountFromWIF(singleValidatorWIF)
func deployAlphabetContract(t *testing.T, e *neotest.Executor, addrNetmap, addrProxy util.Uint160, name string, index, total int64) util.Uint160 { func deployAlphabetContract(t *testing.T, e *neotest.Executor, addrNetmap, addrProxy util.Uint160, name string, index, total int64) util.Uint160 {
c := neotest.CompileFile(t, e.CommitteeHash, alphabetPath, path.Join(alphabetPath, "config.yml")) c := neotest.CompileFile(t, e.CommitteeHash, alphabetPath, path.Join(alphabetPath, "config.yml"))
@ -51,9 +56,7 @@ func newAlphabetInvoker(t *testing.T) (*neotest.Executor, *neotest.ContractInvok
deployProxyContract(t, e, ctrNetmap.Hash) deployProxyContract(t, e, ctrNetmap.Hash)
hash := deployAlphabetContract(t, e, ctrNetmap.Hash, ctrProxy.Hash, "Az", 0, 1) hash := deployAlphabetContract(t, e, ctrNetmap.Hash, ctrProxy.Hash, "Az", 0, 1)
alphabet := getAlphabetAcc(t, e) setAlphabetRole(t, e, committeeAcc.PrivateKey().PublicKey().Bytes())
setAlphabetRole(t, e, alphabet.PrivateKey().PublicKey().Bytes())
return e, e.CommitteeInvoker(hash) return e, e.CommitteeInvoker(hash)
} }
@ -63,9 +66,7 @@ func TestEmit(t *testing.T) {
const method = "emit" const method = "emit"
alphabet := getAlphabetAcc(t, c.Executor) cCommittee := c.WithSigners(neotest.NewSingleSigner(committeeAcc))
cCommittee := c.WithSigners(neotest.NewSingleSigner(alphabet))
cCommittee.InvokeFail(t, "no gas to emit", method) cCommittee.InvokeFail(t, "no gas to emit", method)
transferNeoToContract(t, c) transferNeoToContract(t, c)
@ -141,10 +142,3 @@ func setAlphabetRole(t *testing.T, e *neotest.Executor, new []byte) {
// set committee as NeoFSAlphabet // set committee as NeoFSAlphabet
designInvoker.Invoke(t, stackitem.Null{}, "designateAsRole", int64(noderoles.NeoFSAlphabet), []interface{}{new}) designInvoker.Invoke(t, stackitem.Null{}, "designateAsRole", int64(noderoles.NeoFSAlphabet), []interface{}{new})
} }
func getAlphabetAcc(t *testing.T, e *neotest.Executor) *wallet.Account {
multi, ok := e.Committee.(neotest.MultiSigner)
require.True(t, ok)
return multi.Single(0).Account()
}