From 5d573895ad7c43ccb4fdffbf4ddaefd49ab70ca6 Mon Sep 17 00:00:00 2001 From: Roman Khimov Date: Wed, 8 Jun 2022 23:04:47 +0300 Subject: [PATCH] core: move oracle tests into oracle service --- pkg/core/blockchain_neotest_test.go | 2 +- pkg/{core => services/oracle}/oracle_test.go | 9 ++++----- 2 files changed, 5 insertions(+), 6 deletions(-) rename pkg/{core => services/oracle}/oracle_test.go (98%) diff --git a/pkg/core/blockchain_neotest_test.go b/pkg/core/blockchain_neotest_test.go index ef765774f..50788ed90 100644 --- a/pkg/core/blockchain_neotest_test.go +++ b/pkg/core/blockchain_neotest_test.go @@ -1330,7 +1330,7 @@ func TestBlockchain_VerifyTx(t *testing.T) { cInvoker := e.ValidatorInvoker(cs.Hash) const gasForResponse int64 = 10_000_000 - putOracleRequest(t, cInvoker, "https://get.1234", new(string), "handle", []byte{}, gasForResponse) + cInvoker.Invoke(t, stackitem.Null{}, "requestURL", "https://get.1234", "", "handle", []byte{}, gasForResponse) oracleScript, err := smartcontract.CreateMajorityMultiSigRedeemScript(oraclePubs) require.NoError(t, err) diff --git a/pkg/core/oracle_test.go b/pkg/services/oracle/oracle_test.go similarity index 98% rename from pkg/core/oracle_test.go rename to pkg/services/oracle/oracle_test.go index 6a6decd8a..f8fc6c023 100644 --- a/pkg/core/oracle_test.go +++ b/pkg/services/oracle/oracle_test.go @@ -1,4 +1,4 @@ -package core_test +package oracle_test import ( "bytes" @@ -8,7 +8,6 @@ import ( "fmt" gio "io" "net/http" - "path" "path/filepath" "strings" "sync" @@ -38,7 +37,7 @@ import ( "go.uber.org/zap/zaptest" ) -var oracleModulePath = filepath.Join("..", "services", "oracle") +var pathToInternalContracts = filepath.Join("..", "..", "..", "internal", "contracts") func putOracleRequest(t *testing.T, oracleValidatorInvoker *neotest.ContractInvoker, url string, filter *string, cb string, userData []byte, gas int64) util.Uint256 { @@ -57,7 +56,7 @@ func getOracleConfig(t *testing.T, bc *core.Blockchain, w, pass string, returnOr RefreshInterval: time.Second, AllowedContentTypes: []string{"application/json"}, UnlockWallet: config.Wallet{ - Path: filepath.Join(oracleModulePath, w), + Path: w, Password: pass, }, }, @@ -81,7 +80,7 @@ func getTestOracle(t *testing.T, bc *core.Blockchain, walletPath, pass string) ( orc, err := oracle.NewOracle(orcCfg) require.NoError(t, err) - w, err := wallet.NewWalletFromFile(path.Join(oracleModulePath, walletPath)) + w, err := wallet.NewWalletFromFile(walletPath) require.NoError(t, err) require.NoError(t, w.Accounts[0].Decrypt(pass, w.Scrypt)) return w.Accounts[0], orc, m, ch