MCPcopy Create free account
hub / github.com/33cn/chain33 / TestExecutorErrAPIEnv

Function TestExecutorErrAPIEnv

executor/executor_test.go:255–286  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

253}
254
255func TestExecutorErrAPIEnv(t *testing.T) {
256 exec, q := initEnv(types.GetDefaultCfgstring())
257 types.AllowUserExec = append(types.AllowUserExec, []byte("demo"))
258 exec.disableLocal = true
259 cfg := exec.client.GetConfig()
260 cfg.SetMinFee(0)
261 Register(cfg)
262 execInit(cfg)
263
264 store := store.New(cfg)
265 store.SetQueueClient(q.Client())
266 defer store.Close()
267
268 var txs []*types.Transaction
269 genkey := util.TestPrivkeyList[0]
270 txs = append(txs, util.CreateTxWithExecer(cfg, genkey, "demo"))
271 txlist := &types.ExecTxList{
272 StateHash: nil,
273 Height: 1,
274 BlockTime: time.Now().Unix(),
275 Difficulty: 1,
276 MainHash: nil,
277 MainHeight: 1,
278 ParentHash: nil,
279 Txs: txs,
280 }
281 msg := queue.NewMessage(0, "", 1, txlist)
282 exec.procExecTxList(msg)
283 _, err := exec.client.WaitTimeout(msg, 100*time.Second)
284 fmt.Println(err)
285 assert.Equal(t, true, api.IsAPIEnvError(err))
286}
287func TestCheckTx(t *testing.T) {
288 exec, q := initEnv(types.ReadFile("../cmd/chain33/chain33.test.toml"))
289 cfg := exec.client.GetConfig()

Callers

nothing calls this directly

Calls 15

GetDefaultCfgstringFunction · 0.92
NewFunction · 0.92
CreateTxWithExecerFunction · 0.92
NewMessageFunction · 0.92
IsAPIEnvErrorFunction · 0.92
execInitFunction · 0.85
procExecTxListMethod · 0.80
initEnvFunction · 0.70
RegisterFunction · 0.70
GetConfigMethod · 0.65
SetQueueClientMethod · 0.65
ClientMethod · 0.65

Tested by

no test coverage detected