Andrew Ridgway bf6fe21ea6
Some checks failed
Build and Push Image / Build and push image (push) Failing after 1m58s
first build attempt
2026-05-19 23:24:27 +10:00

32 lines
1.1 KiB
Python

import pytest
import requests
import os
from dotenv import load_dotenv
load_dotenv()
BASE_URL = "http://localhost:8000/api/v1"
def test_health_endpoint():
"""Test the health check endpoint."""
response = requests.get(f"{BASE_URL}/health")
assert response.status_code == 200
assert response.json() == {"status": "healthy", "service": "pr-reviewer"}
def test_trigger_review_invalid_pr():
"""Test triggering a review with an invalid PR payload."""
payload = {"pr_id": "invalid-id"}
response = requests.post(f"{BASE_URL}/review", json=payload)
# Depending on implementation, this might be 400 or 202 (async)
assert response.status_code in [200, 400, 422]
def test_trigger_review_missing_payload():
"""Test triggering a review with no payload."""
response = requests.post(f"{BASE_URL}/review", json={})
assert response.status_code == 422 # FastAPI default for missing required body fields
def test_get_status_nonexistent():
"""Test getting status for a non-existent review."""
response = requests.get(f"{BASE_URL}/status/non-existent-id")
assert response.status_code == 404