-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
73f2134
commit a50c4e3
Showing
1 changed file
with
25 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,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 |