-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #9 from FredHutch/test-api
added python setup for running tests against PROOF API
- Loading branch information
Showing
7 changed files
with
84 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
name: API Tests | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
- dev | ||
- test-api | ||
workflow_dispatch: | ||
|
||
jobs: | ||
api-tests: | ||
runs-on: self-hosted | ||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- name: Install uv | ||
uses: astral-sh/setup-uv@v4 | ||
with: | ||
version: "0.5.8" | ||
|
||
- name: Set up Python | ||
run: uv python install 3.13 | ||
|
||
- name: Run tests | ||
env: | ||
PROOF_API_TOKEN_DEV: ${{ secrets.PROOF_API_TOKEN_DEV }} | ||
run: uv run pytest tests/proof-api/ --verbose |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
# Python-generated files | ||
__pycache__/ | ||
*.py[oc] | ||
build/ | ||
dist/ | ||
wheels/ | ||
*.egg-info | ||
uv.lock | ||
.pytest_cache | ||
|
||
# Virtual environments | ||
.venv | ||
.env |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
3.13 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
[project] | ||
name = "wdl-unit-tests" | ||
version = "0.1.0" | ||
description = "Add your description here" | ||
readme = "README.md" | ||
requires-python = ">=3.13" | ||
dependencies = [ | ||
"httpx>=0.28.1", | ||
"pytest>=8.3.4", | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
[pytest] | ||
python_files = test-*.py | ||
testpaths = tests |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import os | ||
|
||
import httpx | ||
|
||
BASE_URL = "https://proof-api-dev.fredhutch.org" | ||
# test user token | ||
TOKEN = os.getenv("PROOF_API_TOKEN_DEV") | ||
headers = {"Authorization": f"Bearer {TOKEN}"} | ||
info_keys = ["branch", "commit_sha", "short_commit_sha", "commit_message", "tag"] | ||
status_keys = [ | ||
"canJobStart", | ||
"jobStatus", | ||
"cromwellUrl", | ||
"jobStartTime", | ||
"jobEndTime", | ||
"jobInfo", | ||
] | ||
|
||
|
||
def test_info(): | ||
res = httpx.get(f"{BASE_URL}/info") | ||
assert isinstance(res, httpx.Response) | ||
assert list(res.json().keys()) == info_keys | ||
|
||
|
||
def test_status(): | ||
res = httpx.get(f"{BASE_URL}/cromwell-server", headers=headers, timeout=10) | ||
assert isinstance(res, httpx.Response) | ||
assert list(res.json().keys()) == status_keys |