Add unit tests

pull/2/head
Bernhard Mueller 7 years ago
parent b744b578bd
commit ff9f5aa9e3
  1. 0
      tests/__init__.py
  2. 1
      tests/asm_test.py
  3. 26
      tests/contractstorage_test.py
  4. 2
      tests/ethcontract_test.py
  5. 2
      tests/evm_test.py
  6. 2
      tests/rpc_test.py
  7. BIN
      tests/teststorage/contractstorage.fs
  8. BIN
      tests/teststorage/contractstorage.fs.index
  9. 1
      tests/teststorage/contractstorage.fs.lock
  10. 0
      tests/teststorage/contractstorage.fs.tmp
  11. 2
      tests/util_test.py

@ -0,0 +1 @@
import unittest

@ -0,0 +1,26 @@
import unittest
from mythril.ether.contractstorage import get_persistent_storage
import os
class GetAndSearchContractTestCase(unittest.TestCase):
def mockCallback(self, code_hash, code, addresses, balances):
self.isFound = True
pass
def runTest(self):
script_path = os.path.dirname(os.path.realpath(__file__))
storage_dir = os.path.join(script_path, 'teststorage')
storage = get_persistent_storage(storage_dir)
contract = storage.get_contract_by_hash(bytes.fromhex("ea061445eacbe86b7ffed2bb9e52075e"))
self.assertTrue("0x60606040" in contract.code,'error reading contract code from database')
self.isFound = False
storage.search("code#PUSH1#", self.mockCallback)
self.assertTrue(self.isFound,'storage search error')

@ -0,0 +1,2 @@
import unittest

@ -0,0 +1,2 @@
import unittest

@ -0,0 +1,2 @@
import unittest

@ -0,0 +1,2 @@
import unittest
Loading…
Cancel
Save