mirror of https://github.com/ConsenSys/mythril
blockchainethereumsmart-contractssoliditysecurityprogram-analysissecurity-analysissymbolic-execution
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
27 lines
797 B
27 lines
797 B
6 years ago
|
from mythril.interfaces.cli import main
|
||
|
import pytest
|
||
|
import json
|
||
|
|
||
|
import sys
|
||
|
|
||
6 years ago
|
|
||
6 years ago
|
def test_version_opt(capsys):
|
||
|
# Check that "myth --version" returns a string with the word
|
||
|
# "version" in it
|
||
6 years ago
|
sys.argv = ["mythril", "version"]
|
||
6 years ago
|
with pytest.raises(SystemExit) as pytest_wrapped_e:
|
||
|
main()
|
||
|
assert pytest_wrapped_e.type == SystemExit
|
||
|
captured = capsys.readouterr()
|
||
6 years ago
|
assert captured.out.find(" version ") >= 1
|
||
6 years ago
|
|
||
|
# Check that "myth --version -o json" returns a JSON object
|
||
6 years ago
|
sys.argv = ["mythril", "version", "-o", "json"]
|
||
6 years ago
|
with pytest.raises(SystemExit) as pytest_wrapped_e:
|
||
|
main()
|
||
|
assert pytest_wrapped_e.type == SystemExit
|
||
|
captured = capsys.readouterr()
|
||
|
d = json.loads(captured.out)
|
||
|
assert isinstance(d, dict)
|
||
6 years ago
|
assert d["version_str"]
|