Skip to content

Commit

Permalink
tests: reuse centrally defined input variables (#28)
Browse files Browse the repository at this point in the history
  • Loading branch information
athith-g authored Aug 19, 2024
1 parent 40c1ab7 commit 41ba2a4
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 16 deletions.
24 changes: 10 additions & 14 deletions tests/tasks/task_bodies.py
Original file line number Diff line number Diff line change
@@ -1,23 +1,19 @@
"""TES task request bodies used by tests"""

from pathlib import Path

DIR = Path(__file__).parents[2]
input_dir = DIR / "inputs"

from tests.utils import INPUT_DIR

def get_uppercase_task_body(tmp_dir):
"""Returns TES task body that makes the contents of a file uppercase."""
return {
"name": "Hello world",
"inputs": [
{
"url": f"file://{input_dir}/hello.txt",
"url": f"file://{INPUT_DIR}/hello.txt",
"path": "/inputs/hello.txt",
"type": "FILE"
},
{
"url": f"file://{input_dir}/make_uppercase.py",
"url": f"file://{INPUT_DIR}/make_uppercase.py",
"path": "/inputs/make_uppercase.py",
"type": "FILE"
}
Expand Down Expand Up @@ -49,17 +45,17 @@ def get_decryption_task_body(tmp_dir):
"name": "Decrypt with secret key as environment variable",
"inputs": [
{
"url": f"file://{input_dir}/hello.c4gh",
"url": f"file://{INPUT_DIR}/hello.c4gh",
"path": "/inputs/hello.c4gh",
"type": "FILE"
},
{
"url": f"file://{input_dir}/alice.sec",
"url": f"file://{INPUT_DIR}/alice.sec",
"path": "/inputs/alice.sec",
"type": "FILE"
},
{
"url": f"file://{input_dir}/decrypt.sh",
"url": f"file://{INPUT_DIR}/decrypt.sh",
"path": "/inputs/decrypt.sh",
"type": "FILE"
}
Expand Down Expand Up @@ -91,22 +87,22 @@ def get_uppercase_task_with_decryption_body(tmp_dir):
"name": "Decrypt with secret key as environment variable",
"inputs": [
{
"url": f"file://{input_dir}/hello.c4gh",
"url": f"file://{INPUT_DIR}/hello.c4gh",
"path": "/inputs/hello.c4gh",
"type": "FILE"
},
{
"url": f"file://{input_dir}/alice.sec",
"url": f"file://{INPUT_DIR}/alice.sec",
"path": "/inputs/alice.sec",
"type": "FILE"
},
{
"url": f"file://{input_dir}/decrypt.sh",
"url": f"file://{INPUT_DIR}/decrypt.sh",
"path": "/inputs/decrypt.sh",
"type": "FILE"
},
{
"url": f"file://{input_dir}/make_uppercase.py",
"url": f"file://{INPUT_DIR}/make_uppercase.py",
"path": "/inputs/make_uppercase.py",
"type": "FILE"
}
Expand Down
3 changes: 1 addition & 2 deletions tests/tasks/test_tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,11 @@
get_uppercase_task_body,
get_uppercase_task_with_decryption_body,
)
from tests.utils import timeout
from tests.utils import INPUT_TEXT, timeout

TES_URL = "http://localhost:8090/ga4gh/tes/v1"
HEADERS = {"accept": "application/json", "Content-Type": "application/json"}
WAIT_STATUSES = ("UNKNOWN", "INITIALIZING", "RUNNING", "QUEUED")
INPUT_TEXT = "hello world from the input!"


def wait_for_file_download(filename, output_path):
Expand Down

0 comments on commit 41ba2a4

Please sign in to comment.