Add environment to test

pull/375/head
Joran Honig 6 years ago
parent 623a13665a
commit 579a2e5090
  1. 10
      tests/taint_runner_test.py

@ -3,7 +3,7 @@ import pytest
from pytest_mock import mocker
from mythril.laser.ethereum.taint_analysis import *
from mythril.laser.ethereum.svm import GlobalState, Node, Edge, LaserEVM
from mythril.laser.ethereum.state import MachineState
from mythril.laser.ethereum.state import MachineState, Account, Environment
def test_execute_state(mocker):
@ -57,12 +57,14 @@ def test_execute_node(mocker):
def test_execute(mocker):
state_1 = GlobalState(None, None, None, MachineState(gas=10000000))
active_account = Account('0x00')
environment = Environment(active_account, None, None, None, None, None)
state_1 = GlobalState(None, environment, None, MachineState(gas=10000000))
state_1.mstate.stack = [1, 2]
mocker.patch.object(state_1, 'get_current_instruction')
state_1.get_current_instruction.return_value = {"opcode": "PUSH"}
state_2 = GlobalState(None, None, None, MachineState(gas=10000000))
state_2 = GlobalState(None, environment, None, MachineState(gas=10000000))
state_2.mstate.stack = [1, 2, 3]
mocker.patch.object(state_2, 'get_current_instruction')
state_2.get_current_instruction.return_value = {"opcode": "ADD"}
@ -70,7 +72,7 @@ def test_execute(mocker):
node_1 = Node("Test contract")
node_1.states = [state_1, state_2]
state_3 = GlobalState(None, None, None, MachineState(gas=10000000))
state_3 = GlobalState(None, environment, None, MachineState(gas=10000000))
state_3.mstate.stack = [1, 2]
mocker.patch.object(state_3, 'get_current_instruction')
state_3.get_current_instruction.return_value = {"opcode": "ADD"}

Loading…
Cancel
Save