def test_id_1():
    # object_store_store_by not set
    # file_path set by admin to `not_objects` (no need for the dir to exist)
    appconfig = config.GalaxyAppConfiguration(file_path='not_objects',
                                              override_tempdir=False)

    assert appconfig.object_store_store_by == 'id'
Exemple #2
0
def test_base_config_if_running_from_source(monkeypatch, mock_config_file):
    # Simulated condition: running from source, config_file is None.
    monkeypatch.setattr(config, 'running_from_source', True)
    appconfig = config.GalaxyAppConfiguration()
    assert not appconfig.config_file
    assert appconfig.config_dir == os.path.join(appconfig.root, 'config')
    assert appconfig.data_dir == os.path.join(appconfig.root, 'database')
    assert appconfig.managed_config_dir == appconfig.config_dir
def test_uuid_2(mock_config_file, monkeypatch):
    # object_store_store_by not set
    # file_path not set, `files` dir doesn't exist
    monkeypatch.setattr(BaseAppConfiguration, '_path_exists',
                        lambda self, path: False)
    appconfig = config.GalaxyAppConfiguration()

    assert appconfig.object_store_store_by == 'uuid'
def test_id_2(mock_config_file, monkeypatch):
    # object_store_store_by not set
    # file_path not set, `files` dir exists
    monkeypatch.setattr(
        BaseAppConfiguration, '_path_exists', lambda self, path: True
        if os.path.basename(path) == 'files' else False)
    appconfig = config.GalaxyAppConfiguration()

    assert appconfig.object_store_store_by == 'id'
Exemple #5
0
def test_base_config_if_running_not_from_source(monkeypatch, mock_config_file):
    # Simulated condition: running not from source, config_file is None.
    monkeypatch.setattr(config, 'running_from_source', False)
    appconfig = config.GalaxyAppConfiguration(override_tempdir=False)
    assert not appconfig.config_file
    assert appconfig.config_dir == os.getcwd()
    assert appconfig.data_dir == os.path.join(appconfig.config_dir, 'data')
    assert appconfig.managed_config_dir == os.path.join(
        appconfig.data_dir, 'config')
Exemple #6
0
def get_config_data():
    configuration = config.GalaxyAppConfiguration(override_tempdir=False)
    ev = ExpectedValues(configuration)
    items = ((k, v) for k, v in configuration.schema.app_schema.items())
    for key, data in items:
        expected = ev.get_value(key, data)
        loaded = getattr(configuration, key)
        test_data = TestData(key=key, expected=expected, loaded=loaded)
        yield pytest.param(test_data)
Exemple #7
0
def appconfig():
    return config.GalaxyAppConfiguration()
def test_id_1(mock_config_file, monkeypatch):
    # object_store_store_by not set
    # file_path set by admin to `not_objects` (no need for the dir to exist)
    appconfig = config.GalaxyAppConfiguration(file_path='not_objects')

    assert appconfig.object_store_store_by == 'id'
def test_object_store_store_by_set(mock_config_file, monkeypatch):
    # object_store_store_by set by admin
    appconfig = config.GalaxyAppConfiguration(object_store_store_by='id')
    assert appconfig.object_store_store_by == 'id'
def test_object_store_store_by_set():
    # object_store_store_by set by admin
    appconfig = config.GalaxyAppConfiguration(object_store_store_by='id',
                                              override_tempdir=False)
    assert appconfig.object_store_store_by == 'id'
Exemple #11
0
def appconfig(monkeypatch):
    monkeypatch.setattr(config.GalaxyAppConfiguration, '_override_tempdir', lambda a, b: None)
    return config.GalaxyAppConfiguration()
Exemple #12
0
def appconfig():
    return config.GalaxyAppConfiguration(override_tempdir=False)