예제 #1
0
def test_get_versions_one_bundle(housekeeper_api: HousekeeperAPI,
                                 spring_bundle: dict):
    """Test to get latest versions of bundles when no bundles exists"""
    # GIVEN a populated housekeeper_api
    housekeeper_api.add_bundle(spring_bundle)

    # WHEN fetching versions
    versions = helpers.get_versions(housekeeper_api)

    # THEN assert no versions was returned
    assert sum(1 for version in versions) == 1
예제 #2
0
def test_correct_spring_paths(
    housekeeper_api: HousekeeperAPI,
    spring_bundle_symlink_problem: dict,
    symlinked_fastqs: dict,
    new_dir: Path,
):
    """docstring for test_correct_spring_paths"""
    # GIVEN a populated housekeeper_api
    housekeeper_api.add_bundle(spring_bundle_symlink_problem)
    # GIVEN that the spring files exists in the wrong location
    versions = helpers.get_versions(housekeeper_api)
    version = next(versions)
    for file_path in version.files:
        assert not Path(file_path.full_path).exists()

    # WHEN updating the spring paths
    helpers.correct_spring_paths(housekeeper_api)

    # THEN assert that the spring paths has been moved
    for file_path in version.files:
        assert Path(file_path.full_path).exists()
예제 #3
0
    def ensure_hk_bundle(
        store: HousekeeperAPI, bundle_data: dict, include: bool = False
    ) -> hk_models.Bundle:
        """Utility function to add a bundle of information to a housekeeper api"""

        bundle_exists = False
        for bundle in store.bundles():
            if bundle.name != bundle_data["name"]:
                continue
            bundle_exists = True
            _bundle = bundle
            break

        if not bundle_exists:
            _bundle, _version = store.add_bundle(bundle_data)
            store.add_commit(_bundle, _version)

        if include:
            store.include(_version)

        return _bundle