Skip to content

Commit

Permalink
chore: update unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Drew Meyers committed Sep 17, 2024
1 parent 3f993bb commit b98fc9f
Show file tree
Hide file tree
Showing 8 changed files with 5 additions and 1,196 deletions.
17 changes: 5 additions & 12 deletions unity-test/conftest.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
import glob
import json
import os
import pathlib
import re

import fakeredis
Expand Down Expand Up @@ -30,11 +28,6 @@
Base.metadata.create_all(bind=engine)


TEST_DIR = os.path.join(os.path.dirname(os.path.abspath(__file__)), "test_data")
PROCESS_FILES = glob.glob(f"{TEST_DIR}/process_descriptions/*.json")
EXECUTION_FILES = glob.glob(f"{TEST_DIR}/execution_requests/*.json")


def override_get_db():
try:
db = TestingSessionLocal()
Expand Down Expand Up @@ -71,7 +64,6 @@ def fake_filesystem(fs_session, test_directory): # pylint:disable=invalid-name
contents="test",
)
fs_session.create_file(os.path.join(settings.DAG_CATALOG_DIRECTORY, "EchoProcess.py"), contents="test")
fs_session.create_file(os.path.join(settings.DAG_CATALOG_DIRECTORY, "cwl_dag.py"), contents="test")
fs_session.create_dir(settings.DEPLOYED_DAGS_DIRECTORY)
yield fs_session

Expand Down Expand Up @@ -457,16 +449,17 @@ def mock_patch_existing_running_dag_dagrun_task(requests_mock):
)


@pytest.fixture(scope="function", params=PROCESS_FILES)
def deploy_process(test_directory, client, request):
f = open(request.param)
@pytest.fixture(scope="function")
def deploy_process(test_directory, client):
data_filename = os.path.join(test_directory, "..", "process_descriptions", "cwltool_help_dag.json")
f = open(data_filename)
process_json = json.load(f)
process = Process.model_validate(process_json)
response = client.post("/processes", json=process.model_dump())
assert response.status_code == status.HTTP_200_OK
data = response.json()
process = Process.model_validate(data)
assert process.id == pathlib.Path(request.param).stem
assert process.id == "cwltool_help_dag"

yield process

Expand Down
120 changes: 0 additions & 120 deletions unity-test/test_data/execution_requests/EchoProcess.json

This file was deleted.

12 changes: 0 additions & 12 deletions unity-test/test_data/execution_requests/cwl_dag.json

This file was deleted.

120 changes: 0 additions & 120 deletions unity-test/test_data/execution_requests/cwltool_help_dag.json

This file was deleted.

Loading

0 comments on commit b98fc9f

Please sign in to comment.