Skip to content

Commit

Permalink
Add integration test
Browse files Browse the repository at this point in the history
  • Loading branch information
javiermtorres committed Nov 18, 2024
1 parent ce15f58 commit 2ff806e
Showing 1 changed file with 18 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
import requests
from fastapi.testclient import TestClient
from lumigator_schemas.datasets import DatasetFormat, DatasetResponse
from lumigator_schemas.experiments import ExperimentResponse
from lumigator_schemas.extras import ListingResponse

from backend.main import app

Expand Down Expand Up @@ -52,6 +54,21 @@ def test_upload_data_launch_job(local_client: TestClient, dialog_dataset):
)
assert create_inference_job_response.status_code == 201

create_experiments_response = local_client.post(
"/experiments/", headers=headers, json=payload
)
assert create_experiments_response.status_code == 201

get_experiments_response = local_client.get(
"/experiments/")
get_experiments = ListingResponse[ExperimentResponse].model_validate(get_experiments_response.json())
print(get_experiments)
assert get_experiments.total > 0

get_experiment_response = local_client.get(
f"/experiments/{get_experiments.items[0].id}")
assert get_experiment_response.status_code == 200


def test_experiment_non_existing(local_client: TestClient):
non_existing_id = "71aaf905-4bea-4d19-ad06-214202165812"
Expand All @@ -64,4 +81,4 @@ def test_job_non_existing(local_client: TestClient):
non_existing_id = "71aaf905-4bea-4d19-ad06-214202165812"
response = local_client.get(f"/jobs/{non_existing_id}")
assert response.status_code == 404
assert response.json()["detail"] == f"Job {non_existing_id} not found."
assert response.json()["detail"] == f"Job {non_existing_id} not found."

0 comments on commit 2ff806e

Please sign in to comment.