Esempio n. 1
0
def test_reset_chain_on_empty_project_dir(project_dir, write_project_file):
    project = Project()

    data_dir = project.get_blockchain_data_dir('test-chain')
    ensure_path_exists(data_dir)

    chaindata_dir = project.get_blockchain_chaindata_dir('test-chain')
    dapp_dir = project.get_blockchain_dapp_dir('test-chain')
    nodekey_path = project.get_blockchain_nodekey_path('test-chain')
    geth_ipc_path = project.get_blockchain_ipc_path('test-chain')

    # sanity check
    assert os.path.exists(data_dir)
    assert not os.path.exists(chaindata_dir)
    assert not os.path.exists(dapp_dir)
    assert not os.path.exists(nodekey_path)
    assert not os.path.exists(geth_ipc_path)

    reset_chain(data_dir)

    assert os.path.exists(data_dir)
    assert not os.path.exists(chaindata_dir)
    assert not os.path.exists(dapp_dir)
    assert not os.path.exists(nodekey_path)
    assert not os.path.exists(geth_ipc_path)
Esempio n. 2
0
def test_project_directory_properties(project_dir):
    project = Project()

    contracts_dir = get_contracts_dir(project_dir)
    assert is_same_path(project.contracts_dir, contracts_dir)

    build_dir = get_build_dir(project_dir)
    assert is_same_path(project.build_dir, build_dir)

    compiled_contracts_file_path = get_compiled_contracts_file_path(
        project_dir)
    assert is_same_path(project.compiled_contracts_file_path,
                        compiled_contracts_file_path)

    blockchains_dir = get_blockchains_dir(project_dir)
    assert is_same_path(project.blockchains_dir, blockchains_dir)

    data_dir = get_data_dir(project_dir, 'some-test-chain-name')
    assert is_same_path(
        project.get_blockchain_data_dir('some-test-chain-name'), data_dir)

    chaindata_dir = get_chaindata_dir(data_dir)
    assert is_same_path(
        project.get_blockchain_chaindata_dir('some-test-chain-name'),
        chaindata_dir)

    geth_ipc_path = get_geth_ipc_path(data_dir)
    assert is_same_path(
        project.get_blockchain_ipc_path('some-test-chain-name'), geth_ipc_path)
Esempio n. 3
0
def test_reset_chain(project_dir, write_project_file):
    project = Project()

    data_dir = project.get_blockchain_data_dir('test-chain')
    ensure_path_exists(data_dir)

    chaindata_dir = project.get_blockchain_chaindata_dir('test-chain')
    dapp_dir = project.get_blockchain_dapp_dir('test-chain')
    nodekey_path = project.get_blockchain_nodekey_path('test-chain')
    geth_ipc_path = project.get_blockchain_ipc_path('test-chain')

    ensure_path_exists(chaindata_dir)
    ensure_path_exists(dapp_dir)
    write_project_file(nodekey_path)
    write_project_file(geth_ipc_path)

    # sanity check
    assert os.path.exists(data_dir)
    assert os.path.exists(chaindata_dir)
    assert os.path.exists(dapp_dir)
    assert os.path.exists(nodekey_path)
    assert os.path.exists(geth_ipc_path)

    reset_chain(data_dir)

    assert os.path.exists(data_dir)
    assert not os.path.exists(chaindata_dir)
    assert not os.path.exists(dapp_dir)
    assert not os.path.exists(nodekey_path)
    assert not os.path.exists(geth_ipc_path)
def test_project_directory_properties(project_dir):
    project = Project()

    contracts_source_dir = get_contracts_source_dir(project_dir)
    assert is_same_path(project.contracts_source_dir, contracts_source_dir)
    with pytest.warns(DeprecationWarning):
        assert is_same_path(project.contracts_dir, contracts_source_dir)

    build_asset_dir = get_build_asset_dir(project_dir)
    assert is_same_path(project.build_asset_dir, build_asset_dir)
    with pytest.warns(DeprecationWarning):
        assert is_same_path(project.build_dir, build_asset_dir)

    compiled_contracts_asset_path = get_compiled_contracts_asset_path(
        build_asset_dir)
    assert is_same_path(project.compiled_contracts_asset_path,
                        compiled_contracts_asset_path)
    with pytest.warns(DeprecationWarning):
        assert is_same_path(project.compiled_contracts_file_path,
                            compiled_contracts_asset_path)

    base_blockchain_storage_dir = get_base_blockchain_storage_dir(project_dir)
    assert is_same_path(project.base_blockchain_storage_dir,
                        base_blockchain_storage_dir)
    with pytest.warns(DeprecationWarning):
        assert is_same_path(project.blockchains_dir,
                            base_blockchain_storage_dir)

    data_dir = get_data_dir(project_dir, 'some-test-chain-name')
    with pytest.warns(DeprecationWarning):
        assert is_same_path(
            project.get_blockchain_data_dir('some-test-chain-name'), data_dir)

    chaindata_dir = get_chaindata_dir(data_dir)
    with pytest.warns(DeprecationWarning):
        assert is_same_path(
            project.get_blockchain_chaindata_dir('some-test-chain-name'),
            chaindata_dir)

    geth_ipc_path = get_geth_ipc_path(data_dir)
    with pytest.warns(DeprecationWarning):
        assert is_same_path(
            project.get_blockchain_ipc_path('some-test-chain-name'),
            geth_ipc_path)
def test_project_directory_properties(project_dir):
    project = Project()

    contracts_dir = get_contracts_dir(project_dir)
    assert is_same_path(project.contracts_dir, contracts_dir)

    build_dir = get_build_dir(project_dir)
    assert is_same_path(project.build_dir, build_dir)

    compiled_contracts_file_path = get_compiled_contracts_file_path(project_dir)
    assert is_same_path(project.compiled_contracts_file_path, compiled_contracts_file_path)

    blockchains_dir = get_blockchains_dir(project_dir)
    assert is_same_path(project.blockchains_dir, blockchains_dir)

    data_dir = get_data_dir(project_dir, "some-test-chain-name")
    assert is_same_path(project.get_blockchain_data_dir("some-test-chain-name"), data_dir)

    chaindata_dir = get_chaindata_dir(data_dir)
    assert is_same_path(project.get_blockchain_chaindata_dir("some-test-chain-name"), chaindata_dir)

    geth_ipc_path = get_geth_ipc_path(data_dir)
    assert is_same_path(project.get_blockchain_ipc_path("some-test-chain-name"), geth_ipc_path)