Skip to content

Commit

Permalink
factor out get_jobs_list
Browse files Browse the repository at this point in the history
  • Loading branch information
seanshahkarami committed Dec 15, 2023
1 parent 66513de commit 38a3650
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions cmd/cloudscheduler/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,12 @@ def wrap_tests():
yield


def get_jobs_list():
r = requests.get("http://localhost:9770/api/v1/jobs/list")
r.raise_for_status()
return r.json()


def test_submit_requires_auth():
r = requests.post(f"http://localhost:9770/api/v1/submit")
assert r.status_code == HTTPStatus.UNAUTHORIZED
Expand Down Expand Up @@ -174,9 +180,7 @@ def test_submit_success():
# TODO(sean) Use ACCEPTED instead of OK?
assert r.status_code == HTTPStatus.OK

r = requests.get("http://localhost:9770/api/v1/jobs/list")
r.raise_for_status()
jobs = r.json()
jobs = get_jobs_list()
assert len(jobs) == 1
# NOTE(sean) jobs currently returns a map of stringy ints -> jobs
assert jobs["1"]["name"] == "dbaserh"
Expand Down

0 comments on commit 38a3650

Please sign in to comment.