-
Notifications
You must be signed in to change notification settings - Fork 25
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1467 from Sage-Bionetworks/develop-filepath2-mani…
…fest-gen-FDS-2278 Update existing file paths in manifests at generation to conform to new convention
- Loading branch information
Showing
7 changed files
with
309 additions
and
59 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 3 additions & 0 deletions
3
tests/data/mock_manifests/filepath_submission_test_manifest.csv
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
Filename,Sample ID,File Format,Component,Genome Build,Genome FASTA,Id,entityId | ||
schematic - main/Test Filename Upload/txt1.txt,1.0,,BulkRNA-seqAssay,,,01ded8fc-0915-4959-85ab-64e9644c8787,syn62276954 | ||
schematic - main/Test Filename Upload/txt2.txt,2.0,,BulkRNA-seqAssay,,,fd122bb5-3353-4c94-b1f5-0bb93a3e9fc9,syn62276956 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
import logging | ||
from contextlib import nullcontext as does_not_raise | ||
|
||
from pytest_mock import MockerFixture | ||
|
||
from schematic.store.synapse import SynapseStorage | ||
from tests.conftest import metadata_model | ||
|
||
logging.basicConfig(level=logging.DEBUG) | ||
logger = logging.getLogger(__name__) | ||
|
||
|
||
class TestMetadataModel: | ||
def test_submit_filebased_manifest(self, helpers, mocker: MockerFixture): | ||
# spys | ||
spy_upload_file_as_csv = mocker.spy(SynapseStorage, "upload_manifest_as_csv") | ||
spy_upload_file_as_table = mocker.spy( | ||
SynapseStorage, "upload_manifest_as_table" | ||
) | ||
spy_upload_file_combo = mocker.spy(SynapseStorage, "upload_manifest_combo") | ||
spy_add_annotations = mocker.spy( | ||
SynapseStorage, "add_annotations_to_entities_files" | ||
) | ||
|
||
# GIVEN a metadata model object using class labels | ||
meta_data_model = metadata_model(helpers, "class_label") | ||
|
||
# AND a filebased test manifset | ||
manifest_path = helpers.get_data_path( | ||
"mock_manifests/filepath_submission_test_manifest.csv" | ||
) | ||
|
||
# WHEN the manifest it submitted | ||
# THEN submission should complete without error | ||
with does_not_raise(): | ||
manifest_id = meta_data_model.submit_metadata_manifest( | ||
manifest_path=manifest_path, | ||
dataset_id="syn62276880", | ||
manifest_record_type="file_and_entities", | ||
restrict_rules=False, | ||
file_annotations_upload=True, | ||
hide_blanks=False, | ||
) | ||
|
||
# AND the manifest should be submitted to the correct place | ||
assert manifest_id == "syn62280543" | ||
|
||
# AND the manifest should be uploaded as a CSV | ||
spy_upload_file_as_csv.assert_called_once() | ||
# AND annotations should be added to the files | ||
spy_add_annotations.assert_called_once() | ||
|
||
# AND the manifest should not be uploaded as a table or combination of table, file, and entities | ||
spy_upload_file_as_table.assert_not_called() | ||
spy_upload_file_combo.assert_not_called() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.