From 83bedd4840f6e96ae6300447f50c9b86754a0dd1 Mon Sep 17 00:00:00 2001 From: Joao Santos Date: Tue, 6 Apr 2021 15:18:25 +0100 Subject: [PATCH] test: fix broken test --- mythx_cli/fuzz/run.py | 1 + tests/test_fuzz.py | 32 +++++++++++++++++++++----------- 2 files changed, 22 insertions(+), 11 deletions(-) diff --git a/mythx_cli/fuzz/run.py b/mythx_cli/fuzz/run.py index 110ff15..e27560a 100644 --- a/mythx_cli/fuzz/run.py +++ b/mythx_cli/fuzz/run.py @@ -17,6 +17,7 @@ time_limit_seconds = 3000 + @click.command("run") @click.argument("target", default=None, nargs=-1, required=False) @click.option( diff --git a/tests/test_fuzz.py b/tests/test_fuzz.py index 376c930..bccf1b9 100644 --- a/tests/test_fuzz.py +++ b/tests/test_fuzz.py @@ -95,7 +95,7 @@ def test_fuzz_no_target(tmp_path): def test_fuzz_no_contract_at_address(tmp_path): - setup_brownie_project(tmp_path, compiled=False, switch_dir=False) + setup_brownie_project(tmp_path, switch_dir=False) with open(".mythx.yml", "w+") as conf_f: conf_f.write(generate_config_file(base_path=tmp_path)) @@ -118,7 +118,7 @@ def test_fuzz_no_contract_at_address(tmp_path): def test_faas_not_running(tmp_path): - setup_brownie_project(tmp_path, compiled=False, switch_dir=False) + setup_brownie_project(tmp_path, switch_dir=False) with open(".mythx.yml", "w+") as conf_f: conf_f.write(generate_config_file(base_path=tmp_path)) @@ -153,7 +153,7 @@ def test_faas_target_config_file(tmp_path): from the config file. This is possible because the faas not running error is triggered after the Target check. If the target was not available, a different error would be thrown and the test would fail""" - setup_brownie_project(tmp_path, compiled=False, switch_dir=False) + setup_brownie_project(tmp_path, switch_dir=False) with open(".mythx.yml", "w+") as conf_f: conf_f.write(generate_config_file(base_path=tmp_path)) @@ -220,7 +220,7 @@ def test_rpc_not_running(tmp_path): ), ) def test_fuzz_run(tmp_path, keyword): - setup_brownie_project(tmp_path, compiled=False, switch_dir=False) + setup_brownie_project(tmp_path, switch_dir=False) with open(".mythx.yml", "w+") as conf_f: conf_f.write(generate_config_file(base_path=tmp_path)) @@ -267,26 +267,36 @@ def test_fuzz_subcommands_present(keyword): assert keyword in result.output -@patch('mythx_cli.analyze.scribble.ScribbleMixin.instrument_solc_in_place') + +@patch("mythx_cli.analyze.scribble.ScribbleMixin.instrument_solc_in_place") def test_fuzz_arm(mock, tmp_path): - setup_brownie_project(tmp_path, compiled=False, switch_dir=False) + setup_brownie_project(tmp_path, switch_dir=False) runner = CliRunner() result = runner.invoke(cli, ["fuzz", "arm", f"{tmp_path}/contracts/sample.sol"]) mock.assert_called() - mock.assert_called_with(file_list=(f"{tmp_path}/contracts/sample.sol",), scribble_path='scribble', remappings=[], solc_version=None) + mock.assert_called_with( + file_list=(f"{tmp_path}/contracts/sample.sol",), + scribble_path="scribble", + remappings=[], + solc_version=None, + ) assert result.exit_code == 0 -@patch('mythx_cli.analyze.scribble.ScribbleMixin.disarm_solc_in_place') +@patch("mythx_cli.analyze.scribble.ScribbleMixin.disarm_solc_in_place") def test_fuzz_disarm(mock, tmp_path): - setup_brownie_project(tmp_path, compiled=False, switch_dir=False) + setup_brownie_project(tmp_path, switch_dir=False) runner = CliRunner() result = runner.invoke(cli, ["fuzz", "disarm", f"{tmp_path}/contracts/sample.sol"]) mock.assert_called() - mock.assert_called_with(file_list=(f"{tmp_path}/contracts/sample.sol",), scribble_path='scribble', remappings=[], solc_version=None) + mock.assert_called_with( + file_list=(f"{tmp_path}/contracts/sample.sol",), + scribble_path="scribble", + remappings=[], + solc_version=None, + ) assert result.exit_code == 0 -