Exemplo n.º 1
0
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
Exemplo n.º 2
0
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
Exemplo n.º 3
0
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
Exemplo n.º 4
0
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
Exemplo n.º 5
0
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
Exemplo n.º 6
0
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
Exemplo n.º 7
0
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
Exemplo n.º 8
0
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
Exemplo n.º 9
0
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
Exemplo n.º 10
0
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
Exemplo n.º 11
0
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
Exemplo n.º 12
0
 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
Exemplo n.º 13
0
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()
Exemplo n.º 14
0
def test_01_get_contracts():
    ezo = EZO(config())
    ks = views.get_contracts(None, ezo)
    assert len(ks) > 0
Exemplo n.º 15
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
Exemplo n.º 16
0
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
Exemplo n.º 17
0
def test_02_get_deploys():
    ezo = EZO(config())
    ks = views.get_deploys(None, ezo)
    assert len(ks) > 0