diff --git a/apps/schematic/api/project.json b/apps/schematic/api/project.json index aa6f2d28cf..2ca8f065f5 100644 --- a/apps/schematic/api/project.json +++ b/apps/schematic/api/project.json @@ -105,7 +105,7 @@ "test": { "executor": "nx:run-commands", "options": { - "command": "poetry run pytest -m unit", + "command": "poetry run pytest -m 'not secrets'", "cwd": "apps/schematic/api" } }, diff --git a/apps/schematic/api/schematic_api/test/test_manifest_validation_controller_impl.py b/apps/schematic/api/schematic_api/test/test_manifest_validation_controller_impl.py index dcd30a2270..f975680365 100644 --- a/apps/schematic/api/schematic_api/test/test_manifest_validation_controller_impl.py +++ b/apps/schematic/api/schematic_api/test/test_manifest_validation_controller_impl.py @@ -1,7 +1,6 @@ """Tests for validation endpoint functions""" from unittest.mock import patch -import pytest from schematic_api.models.basic_error import BasicError import schematic_api.controllers.manifest_validation_controller_impl @@ -57,7 +56,6 @@ def test_500(self, correct_manifest_path: str, test_schema_url: str) -> None: assert isinstance(result, BasicError) -@pytest.mark.unit class TestSubmitManifestJson: """Tests submit_manifest_""" @@ -100,7 +98,6 @@ def test_500(self, correct_manifest_path: str, test_schema_url: str) -> None: assert isinstance(result, BasicError) -@pytest.mark.unit class TestValidateManifestCsv: """Tests validate_manifest_csv""" @@ -168,7 +165,6 @@ def test_500(self, correct_manifest_path: str, test_schema_url: str) -> None: assert isinstance(result, BasicError) -@pytest.mark.unit class TestValidateManifestJson: """Tests validate_manifest_json""" diff --git a/apps/schematic/api/schematic_api/test/test_synapse_endpoints.py b/apps/schematic/api/schematic_api/test/test_synapse_endpoints.py index 3833d04c93..514278b6eb 100644 --- a/apps/schematic/api/schematic_api/test/test_synapse_endpoints.py +++ b/apps/schematic/api/schematic_api/test/test_synapse_endpoints.py @@ -1,6 +1,7 @@ """Tests for endpoints that use Synapse without mocking the Synapse client""" import json +import os import pytest import yaml @@ -14,14 +15,21 @@ csv_to_json_str, ) -with open("schematic_api/test/data/synapse_config.yaml", "r", encoding="utf-8") as file: - secrets = yaml.safe_load(file) - SYNAPSE_TOKEN = secrets["synapse_token"] - TEST_DATASET = secrets["test_dataset"] - TEST_MANIFEST = secrets["test_manifest"] - TEST_ASSET_VIEW = secrets["test_asset_view"] - TEST_PROJECT = secrets["test_project"] - +SECRETS_FILE = "schematic_api/test/data/synapse_config.yaml" +EXAMPLE_SECRETS_FILE = "schematic_api/test/data/synapse_config_example.yaml" + +if os.path.exists(SECRETS_FILE): + with open(SECRETS_FILE, "r", encoding="utf-8") as file: + secrets = yaml.safe_load(file) +else: + with open(EXAMPLE_SECRETS_FILE, "r", encoding="utf-8") as file: + secrets = yaml.safe_load(file) + +SYNAPSE_TOKEN = secrets["synapse_token"] +TEST_DATASET = secrets["test_dataset"] +TEST_MANIFEST = secrets["test_manifest"] +TEST_ASSET_VIEW = secrets["test_asset_view"] +TEST_PROJECT = secrets["test_project"] HEADERS = { "Accept": "application/json",