Пример #1
0
def test_cli_config_get_project_dir(config_dir):
    # implicit project directory
    test_dir = Path.cwd()
    os.chdir(config_dir)
    cli_config = CLIConfig()
    assert cli_config.get_project_dir() == Path.cwd().resolve()
    os.chdir(test_dir)

    # explicit project directory
    cli_config = CLIConfig(config_dir)
    assert cli_config.get_project_dir() == config_dir
Пример #2
0
def test_cli_config_services_setup(config_dir):
    cli_config = CLIConfig(config_dir)

    assert cli_config.get_services_setup() is False

    cli_config.update_services_setup(True)

    assert cli_config.get_services_setup() is True
Пример #3
0
def test_cli_config_instance_path(config_dir):
    cli_config = CLIConfig(config_dir)

    with pytest.raises(InvenioCLIConfigError):
        cli_config.get_instance_path()

    # Update instance path to now see if we retrieve it
    instance_path = config_dir / '.venv/'
    cli_config.update_instance_path(instance_path)
    assert cli_config.get_instance_path() == Path(instance_path)
Пример #4
0
def test_cli_config_instance_path(config_dir):
    cli_config = CLIConfig(config_dir)

    assert cli_config.get_instance_path() == Path('')

    # Update instance path to now see if we retrieve it
    instance_path = os.path.join(config_dir, '.venv/')
    cli_config.update_instance_path(instance_path)

    assert cli_config.get_instance_path() == Path(instance_path)
Пример #5
0
def test_cli_config_dot_invenio_not_found():
    with pytest.raises(InvenioCLIConfigError):
        CLIConfig()
Пример #6
0
def test_cli_config_get_project_shortname(config_dir):
    cli_config = CLIConfig(config_dir)

    assert cli_config.get_project_shortname() == 'my-site'
Пример #7
0
def test_cli_config_get_project_dir(config_dir):
    cli_config = CLIConfig(config_dir)

    assert cli_config.get_project_dir() == config_dir
Пример #8
0
def test_cli_config_config_files_not_found(patched_exit, config_dir):
    wrong_path = tempfile.TemporaryDirectory()

    cli_config = CLIConfig(wrong_path.name)

    patched_exit.assert_called_with(1)