def test_chainmanager_calls_mints(monkeypatch, mockossystem, mocksubprocess,
                                  mockregions, ethermint_version,
                                  mockamibuilder, tmp_files_dir, moto):
    # mock out all reading of *mint calls results
    monkeypatch.setattr('chainmanager.fill_validators', MagicMock)
    chainmanager = Chainmanager()
    chainmanager.create_ethermint_network(mockregions, ethermint_version)

    calls = mockossystem.call_args_list

    ethermint_calls = filter(
        lambda call: all(x in call[0][0]
                         for x in ["ethermint -datadir", "init"]), calls)
    tendermint_calls = filter(
        lambda call: "tendermint gen_validator | tail -n +3 > " in call[0][0],
        calls)

    assert len(ethermint_calls) == 1
    assert len(tendermint_calls) == len(mockregions)
Ejemplo n.º 2
0
def create(regions, ethermint_version, name_root, num_processes, no_ami_cache,
           chain_file):
    chainmanager = Chainmanager(num_processes=num_processes)
    chain = chainmanager.create_ethermint_network(regions,
                                                  ethermint_version,
                                                  name_root,
                                                  no_ami_cache=no_ami_cache)

    chain_file.write(json.dumps(chain.serialize()))

    logger.info("Created a chain ".format(chain))