feat: add Python integration tests for HTTP endpoints
This commit is contained in:
@@ -0,0 +1,26 @@
|
||||
"""Smoke tests for pipeline-runner REST API endpoints."""
|
||||
|
||||
import pytest
|
||||
import requests
|
||||
|
||||
|
||||
test_get_endpoints = [
|
||||
("api/pipelines", 200, list),
|
||||
("api/runs/nonexistent-id/status", 404, dict),
|
||||
]
|
||||
|
||||
|
||||
@pytest.mark.parametrize("endpoint,expected_status,expected_type", test_get_endpoints)
|
||||
def test_get_endpoints(pipeline_server, endpoint, expected_status, expected_type):
|
||||
"""Check HTTP status code and response content-type for GET endpoints."""
|
||||
response = requests.get(f"{pipeline_server.base_url}/{endpoint}")
|
||||
assert response.status_code == expected_status
|
||||
assert "application/json" in response.headers.get("Content-Type", "")
|
||||
data = response.json()
|
||||
assert isinstance(data, expected_type)
|
||||
|
||||
|
||||
def test_cors_headers(pipeline_server):
|
||||
"""Check that CORS headers are present on responses."""
|
||||
response = requests.get(f"{pipeline_server.base_url}/api/pipelines")
|
||||
assert response.headers.get("Access-Control-Allow-Origin") == "*"
|
||||
Reference in New Issue
Block a user