def test_02a_ezo_deploy_bad_contract_name_with_error(capsys): with EZOTestApp(argv=['deploy', 'BadContractNameLtd', '-t', 'test'], config_files=['testezo.conf']) as app: app.ezo = EZO(app.config["ezo"]) app.run() out, err = capsys.readouterr() assert 'not found -- has it been compiled' in err
def test_01a_ezo_compile_contract_no_contract_by_filename_with_error(capsys): with EZOTestApp(argv=['compile', 'throatwobbler_mangrove.sol'], config_files=['testezo.conf']) as app: app.ezo = EZO(app.config["ezo"]) app.run() out, err = capsys.readouterr() assert 'No such file or directory' in err
def test_02_ezo_deploy_contract_no_overwrite_with_error(capsys): with EZOTestApp(argv=['deploy', 'TimestampRequestOracle', '-t', 'test'], config_files=['testezo.conf']) as app: app.ezo = EZO(app.config["ezo"]) app.run() out, err = capsys.readouterr() assert 'deployment on test already exists for contract ' in err
def test_01_ezo_compile_contract(capsys): with EZOTestApp(argv=['compile', 'time_oracle.sol', '--overwrite'], config_files=['testezo.conf']) as app: app.ezo = EZO(app.config["ezo"]) app.run() out, err = capsys.readouterr() assert 'CONTRACT' in err
def test_g_ezo_send_tx_missing_params(capsys): with EZOTestApp(argv=['send', 'tx', '-t', 'test'], config_files=['testezo.conf']) as app: app.ezo = EZO(app.config["ezo"]) app.run() out, err = capsys.readouterr() assert 'missing parameters for send tx' in err
def test_f_ezo_deploy(capsys): with EZOTestApp(argv=['view', 'deploys'], config_files=['testezo.conf']) as app: app.ezo = EZO(app.config["ezo"]) app.run() out, err = capsys.readouterr() assert 'deploy' in out
def test_g_ezo_view_contracts(capsys): with EZOTestApp(argv=['view', 'contracts'], config_files=['testezo.conf']) as app: app.ezo = EZO(app.config["ezo"]) app.run() out, err = capsys.readouterr() assert 'contract' in out
def test_g_ezo_create_gibberish_command(capsys): with EZOTestApp(argv=['create', 'bigdufus'], config_files=['testezo.conf']) as app: app.ezo = EZO(app.config["ezo"]) app.run() out, err = capsys.readouterr() assert 'Ezo needs more words to work' in out
def test_02b_ezo_deploy_contract_missing_target_with_error(capsys): with EZOTestApp(argv=['deploy', 'BadContractNameLtd'], config_files=['testezo.conf']) as app: app.ezo = EZO(app.config["ezo"]) app.run() out, err = capsys.readouterr() assert 'target must be set with the -t option before deploying' in err
def test_01a_ezo_compile_contract_no_overwrite_with_error(capsys): with EZOTestApp(argv=['compile', 'time_oracle.sol'], config_files=['testezo.conf']) as app: app.ezo = EZO(app.config["ezo"]) app.run() out, err = capsys.readouterr() assert 'already exists' in err assert 'error while persisting Contract to datastore' in err
def test_02c_ezo_deploy_contract_bad_target_name_with_error(capsys): with EZOTestApp(argv=[ 'deploy', 'TimestampRequestOracle', '-t', 'veryNaughtTargetName' ], config_files=['testezo.conf']) as app: app.ezo = EZO(app.config["ezo"]) app.run() out, err = capsys.readouterr() assert '' in err
def project(self): ezo = self.app.ezo # set the Source template directory from config Source.templates_dir = ezo.config["templates-dir"] res, err = EZO.create_project(self.app.pargs.term) if err: print(err) return err print( bright( blue("new ezo project '{}' created".format( self.app.pargs.term)))) print(reset("")) return
def main(): with EZOApp() as app: app.ezo = EZO(app.config["ezo"]) app.add_template_dir(app.ezo.config["templates-dir"]) EZO.log = app.log try: app.run() except CaughtSignal as e: # determine what the signal is, and do something with it? from signal import SIGINT, SIGABRT if e.signum == SIGINT: # do something... maybe change the exit code? print("exiting...1") app.exit_code = 110 elif e.signum == SIGABRT: # do something else... print("exiting...") app.exit_code = 111 except FrameworkError as e: # do something when a framework error happens print("FrameworkError => %s" % e) # and maybe set the exit code to something unique as well app.exit_code = 300 finally: # reset terminal print(reset("")) # Maybe we want to see a full-stack trace for the above # exceptions, but only if --debug was passed? if app.debug: import traceback traceback.print_exc()
def test_01_get_contracts(): ezo = EZO(config()) ks = views.get_contracts(None, ezo) assert len(ks) > 0
def test_g_ezo_missing_command(capsys): with EZOTestApp(argv=[], config_files=['testezo.conf']) as app: app.ezo = EZO(app.config["ezo"]) app.run() out, err = capsys.readouterr() assert 'Ezo needs more words to work' in out
def test_g_ezo_send_tx_missing_target_and_missing_params(capsys): with EZOTestApp(argv=['send', 'tx'], config_files=['testezo.conf']) as app: app.ezo = EZO(app.config["ezo"]) app.run() out, err = capsys.readouterr() assert 'target must be set with the -t option before deploying' in err
def test_02_get_deploys(): ezo = EZO(config()) ks = views.get_deploys(None, ezo) assert len(ks) > 0