From d3e200bb22234e03ac4373499715cf2102874b55 Mon Sep 17 00:00:00 2001 From: Nikhil Parasaram Date: Sat, 2 Feb 2019 19:50:34 +0530 Subject: [PATCH] Fix analysis tests --- tests/mythril/analyzer_test.py | 16 ---------------- tests/mythril/mythril_analyzer_test.py | 24 ++++++++++++++++++++++++ 2 files changed, 24 insertions(+), 16 deletions(-) delete mode 100644 tests/mythril/analyzer_test.py create mode 100644 tests/mythril/mythril_analyzer_test.py diff --git a/tests/mythril/analyzer_test.py b/tests/mythril/analyzer_test.py deleted file mode 100644 index 2f903a7c..00000000 --- a/tests/mythril/analyzer_test.py +++ /dev/null @@ -1,16 +0,0 @@ -import pytest -from pathlib import Path -from mythril.mythril import * - -fire_lasers_execute = [] - - -def fire_lasers_test(): - disassembler = MythrilDisassembler(eth=None) - disassembler.load_from_solidity( - Path(__file__).parent.parent / "testdata/input_contracts/origin.sol" - ) - analyzer = MythrilAnalyzer(disassembler) - issues = analyzer.fire_lasers(strategy="dfs").sorted_issues() - assert len(issues) == 1 - assert issues["swc-id"] == "111" diff --git a/tests/mythril/mythril_analyzer_test.py b/tests/mythril/mythril_analyzer_test.py new file mode 100644 index 00000000..730c3046 --- /dev/null +++ b/tests/mythril/mythril_analyzer_test.py @@ -0,0 +1,24 @@ +import pytest +from pathlib import Path +from mythril.mythril import * + + +def test_fire_lasers(): + disassembler = MythrilDisassembler(eth=None) + print(str((Path(__file__).parent.parent / "testdata/input_contracts/origin.sol"))) + print(Path(__file__)) + disassembler.load_from_solidity( + [ + str( + ( + Path(__file__).parent.parent / "testdata/input_contracts/origin.sol" + ).absolute() + ) + ] + ) + analyzer = MythrilAnalyzer(disassembler) + issues = analyzer.fire_lasers( + strategy="dfs", max_depth=30, transaction_count=2, create_timeout=10, modules=[] + ).sorted_issues() + assert len(issues) == 1 + assert issues[0]["swc-id"] == "111"