Ejemplo n.º 1
0
def test_medium_generate_remote_directory(mock_home, workspace_config):
    medium = TomlConfigurationMedium()
    medium._global_config = GlobalConfig(general=GeneralConfig(
        allow_uninitiated_workspaces=False, remote_root="my-root-for-test"), )
    generated_dir = medium.generate_remote_directory(workspace_config)

    assert str(generated_dir).startswith("my-root-for-test/workspace_")
Ejemplo n.º 2
0
def test_medium_is_workspace_root(mock_home):
    medium = TomlConfigurationMedium()
    global_config = GlobalConfig(general=GeneralConfig(
        allow_uninitiated_workspaces=False, remote_root="my-root-for-test"), )
    medium._global_config = global_config

    test_workspace = mock_home / "foo" / "bar"
    test_workspace.mkdir(parents=True)

    # No config - isn't workspace
    assert not medium.is_workspace_root(test_workspace)

    # Can find config - is workspace
    (test_workspace / WORKSPACE_CONFIG).write_text("[push]")
    assert medium.is_workspace_root(test_workspace)

    # No config, but uninitiated workspaces allowed - is workspace
    (test_workspace / WORKSPACE_CONFIG).unlink()
    global_config.general.allow_uninitiated_workspaces = True
    assert medium.is_workspace_root(test_workspace)