def test_chain_config_computed_properties(xdg_helios_root):
    data_dir = get_local_data_dir('muffin', xdg_helios_root)
    chain_config = ChainConfig(network_id=1234, data_dir=data_dir)

    assert chain_config.network_id == 1234
    assert chain_config.data_dir == data_dir
    assert chain_config.database_dir == data_dir / DATABASE_DIR_NAME / "full"
    assert chain_config.nodekey_path == get_nodekey_path(data_dir)
示例#2
0
 def nodekey_path(self) -> Path:
     """
     Path where the nodekey is stored
     """
     if self._nodekey_path is None:
         if self._nodekey is not None:
             return None
         else:
             return get_nodekey_path(self.data_dir)
     else:
         return self._nodekey_path
def test_chain_config_computed_properties_custom_xdg(tmpdir, xdg_helios_root):
    alt_xdg_root = tmpdir.mkdir('helios-custom')
    assert not is_under_path(alt_xdg_root, xdg_helios_root)

    data_dir = get_data_dir_for_network_id(1, alt_xdg_root)
    chain_config = ChainConfig(helios_root_dir=alt_xdg_root, network_id=1)

    assert chain_config.network_id == 1
    assert chain_config.data_dir == data_dir
    assert chain_config.database_dir == data_dir / DATABASE_DIR_NAME / "full"
    assert chain_config.nodekey_path == get_nodekey_path(data_dir)