Skip to content

Commit

Permalink
adding fix for bug with metadata upload
Browse files Browse the repository at this point in the history
  • Loading branch information
haimasree committed May 24, 2022
1 parent 891b7fb commit a88f1d5
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 8 deletions.
3 changes: 3 additions & 0 deletions kipoi_containers/singularityhelper.py
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,9 @@ def update_existing_singularity_container(
filename,
)

url = f"{ZENODO_DEPOSITION}/{new_deposition_id}"
upload_metadata(zenodo_client, url, model_group)

# publish the newly created revision
if push:
response = push_deposition(zenodo_client, new_deposition_id)
Expand Down
19 changes: 11 additions & 8 deletions test-singularity/test_singularity_helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
import requests
import json
from pathlib import Path
from datetime import datetime

from github import Github
import pytest
Expand Down Expand Up @@ -64,13 +65,6 @@ def test_get_available_sc_depositions(zenodo_client):
)

assert len(response_json) == singularity_container_number
# TODO: The test below does not seem to be working
# for index, item in enumerate(response_json):
# for file_obj in item["files"]:
# assert (
# "kipoi-docker" in file_obj["filename"]
# or "busybox_latest" in file_obj["filename"]
# )


def test_get_existing_sc_by_recordid(zenodo_client):
Expand All @@ -95,13 +89,22 @@ def test_update_existing_singularity_container(
push=False,
)
)
new_deposition_id = new_test_singularity_dict.get("new_deposition_id")
response = singularityhelper.get_deposit(zenodo_client, new_deposition_id)
respone_metadata = response["metadata"]
assert respone_metadata["publication_date"] == datetime.today().strftime(
"%Y-%m-%d"
)
assert respone_metadata["title"] == "Test singularity container"

for key in ["url", "md5", "name"]:
assert new_test_singularity_dict.get(key) == test_singularity_dict.get(
key
) # If push=True this will be different
assert new_test_singularity_dict["file_id"] == ""

zenodo_client.delete_content(
f"{singularityhelper.ZENODO_DEPOSITION}/{new_test_singularity_dict.get('new_deposition_id')}"
f"{singularityhelper.ZENODO_DEPOSITION}/{new_deposition_id}"
)


Expand Down

0 comments on commit a88f1d5

Please sign in to comment.