Skip to content

Commit

Permalink
Run through simulate e2e fully [caveats]
Browse files Browse the repository at this point in the history
  • Loading branch information
fivegrant committed Aug 16, 2023
1 parent e1abd96 commit b0ad61d
Showing 1 changed file with 24 additions and 4 deletions.
28 changes: 24 additions & 4 deletions tests/integration/test_simulate.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# import json
import json
import re

import pytest

Expand All @@ -9,10 +10,9 @@

@pytest.mark.example_dir("simulate")
def test_simulate_example(example_context, client, worker, requests_mock):
# job_id = example_context["tds_simulation"]["id"]
request = example_context["request"]
# config_id = request["model_config_id"]
# model = json.loads(example_context["fetch"](config_id + ".json"))
config_id = request["model_config_id"]
model = json.loads(example_context["fetch"](config_id + ".json"))

requests_mock.post(f"{TDS_URL}/simulations/", json={"id": None})

Expand All @@ -28,4 +28,24 @@ def test_simulate_example(example_context, client, worker, requests_mock):
status = response.json()["status"]
assert status == "queued"

tds_sim = example_context["tds_simulation"]
tds_sim["id"] = simulation_id

requests_mock.get(f"{TDS_URL}/simulations/{simulation_id}", json=tds_sim)
requests_mock.put(
f"{TDS_URL}/simulations/{simulation_id}", json={"status": "success"}
)
requests_mock.get(f"{TDS_URL}/model_configurations/{config_id}", json=model)
# TODO: Save files to locations where we can check against them
upload_url = re.compile("upload-url")
requests_mock.get(upload_url, json={"url": "http://WONTWORK"})
requests_mock.put("http://WONTWORK", json={"url": "WONTWORK"})

# TODO: Mock PyCIEMSS lib
worker.work(burst=True)

response = client.get(
f"/status/{simulation_id}",
)
status = response.json()["status"]
assert status == "complete"

0 comments on commit b0ad61d

Please sign in to comment.