From c2b832d314348740b4b44c2f2ee59bbc34e0b57d Mon Sep 17 00:00:00 2001 From: GiaJordan Date: Tue, 27 Aug 2024 09:58:16 -0700 Subject: [PATCH] move test to integration dir --- tests/integration/test_metadata_model.py | 42 ++++++++++++++++++++++++ tests/test_metadata.py | 22 ------------- 2 files changed, 42 insertions(+), 22 deletions(-) create mode 100644 tests/integration/test_metadata_model.py 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"