Skip to content

Commit

Permalink
add test for draw endpoint
Browse files Browse the repository at this point in the history
  • Loading branch information
mpangrazzi committed Jan 10, 2025
1 parent 73f2134 commit a50c4e3
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions tests/test_it_draw.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
from fastapi.testclient import TestClient
from hayhooks.server import app
from tests.test_it_deploy import deploy_pipeline
from pathlib import Path

client = TestClient(app)


def test_draw_pipeline():
pipeline_file = Path(__file__).parent / "test_files" / "working_pipelines/test_pipeline_01.yml"
pipeline_data = {"name": pipeline_file.stem, "source_code": pipeline_file.read_text()}

deploy_response = deploy_pipeline(pipeline_data)
assert deploy_response.status_code == 200

draw_response = client.get(f"/draw/{pipeline_data['name']}")
assert draw_response.status_code == 200

assert draw_response.headers["Content-Type"] == "image/png"
assert len(draw_response.content) > 0


def test_draw_non_existent_pipeline():
draw_response = client.get("/draw/non_existent_pipeline")
assert draw_response.status_code == 404

0 comments on commit a50c4e3

Please sign in to comment.