From 84181834989ec29ff995effb3339530703c7ab0f Mon Sep 17 00:00:00 2001 From: Alex Vanin Date: Thu, 13 Jan 2022 15:02:54 +0300 Subject: [PATCH] Revert "[#198] test: Adopt `neotest` changes" This reverts commit 17907f94578593da326d61653fecbcf69d671da1. --- tests/alphabet_test.go | 20 +++++++------------- 1 file changed, 7 insertions(+), 13 deletions(-) diff --git a/tests/alphabet_test.go b/tests/alphabet_test.go index 090aecd..aef4dd2 100644 --- a/tests/alphabet_test.go +++ b/tests/alphabet_test.go @@ -18,6 +18,11 @@ import ( 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 { 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) hash := deployAlphabetContract(t, e, ctrNetmap.Hash, ctrProxy.Hash, "Az", 0, 1) - alphabet := getAlphabetAcc(t, e) - - setAlphabetRole(t, e, alphabet.PrivateKey().PublicKey().Bytes()) + setAlphabetRole(t, e, committeeAcc.PrivateKey().PublicKey().Bytes()) return e, e.CommitteeInvoker(hash) } @@ -63,9 +66,7 @@ func TestEmit(t *testing.T) { const method = "emit" - alphabet := getAlphabetAcc(t, c.Executor) - - cCommittee := c.WithSigners(neotest.NewSingleSigner(alphabet)) + cCommittee := c.WithSigners(neotest.NewSingleSigner(committeeAcc)) cCommittee.InvokeFail(t, "no gas to emit", method) transferNeoToContract(t, c) @@ -141,10 +142,3 @@ func setAlphabetRole(t *testing.T, e *neotest.Executor, new []byte) { // set committee as NeoFSAlphabet 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() -}