diff --git a/tests/integration/test_metadata_model.py b/tests/integration/test_metadata_model.py new file mode 100644 index 000000000..29167c991 --- /dev/null +++ b/tests/integration/test_metadata_model.py @@ -0,0 +1,42 @@ +import logging +from contextlib import contextmanager +from unittest.mock import patch + +from schematic.models.metadata import MetadataModel + +logging.basicConfig(level=logging.DEBUG) +logger = logging.getLogger(__name__) + + +@contextmanager +def does_not_raise(): + yield + + +def metadata_model(helpers, data_model_labels): + metadata_model = MetadataModel( + inputMModelLocation=helpers.get_data_path("example.model.jsonld"), + data_model_labels=data_model_labels, + inputMModelLocationType="local", + ) + + return metadata_model + + +class TestMetadataModel: + def test_submit_filebased_manifest(self, helpers): + meta_data_model = metadata_model(helpers, "class_label") + + manifest_path = helpers.get_data_path( + "mock_manifests/filepath_submission_test_manifest.csv" + ) + + with does_not_raise(): + manifest_id = meta_data_model.submit_metadata_manifest( + manifest_path=manifest_path, + dataset_id="syn62276880", + manifest_record_type="file_only", + restrict_rules=False, + file_annotations_upload=True, + ) + assert manifest_id == "syn62280543" diff --git a/tests/test_metadata.py b/tests/test_metadata.py index 8065f793a..b192f5387 100644 --- a/tests/test_metadata.py +++ b/tests/test_metadata.py @@ -16,11 +16,6 @@ logger = logging.getLogger(__name__) -@contextmanager -def does_not_raise(): - yield - - def metadata_model(helpers, data_model_labels): metadata_model = MetadataModel( inputMModelLocation=helpers.get_data_path("example.model.jsonld"), @@ -149,20 +144,3 @@ def test_submit_metadata_manifest( hide_blanks=hide_blanks, ) assert mock_manifest_id == "mock manifest id" - - def test_submit_filebased_manifest(self, helpers): - meta_data_model = metadata_model(helpers, "class_label") - - manifest_path = helpers.get_data_path( - "mock_manifests/filepath_submission_test_manifest.csv" - ) - - with does_not_raise(): - manifest_id = meta_data_model.submit_metadata_manifest( - manifest_path=manifest_path, - dataset_id="syn62276880", - manifest_record_type="file_only", - restrict_rules=False, - file_annotations_upload=True, - ) - assert manifest_id == "syn62280543"