Files
integration-test/run_test.py
T
salcedo 8623db4c56
Integration Test / integration-test (push) Waiting to run
initial commit
2025-07-29 16:17:23 -05:00

41 lines
1.2 KiB
Python

import pytest
import requests
def test_health_endpoint():
"""
Test the health endpoint to ensure it returns the expected response.
Makes an HTTP GET request to the health endpoint and validates:
- The request is successful (status code 200)
- The response is valid JSON
- The response contains results.message == "ok"
"""
url = "https://api.cleverbrag.epsilon.cleverthis.com/v3/health"
# Make the HTTP request
response = requests.get(url)
# Assert the request was successful
assert (
response.status_code == 200
), f"Expected status code 200, got {response.status_code}"
# Parse the JSON response
json_response = response.json()
# Validate the response structure and content
assert "results" in json_response, "Response should contain 'results' key"
assert (
"message" in json_response["results"]
), "Response results should contain 'message' key"
assert (
json_response["results"]["message"] == "ok"
), f"Expected message 'ok', got '{json_response['results']['message']}'"
if __name__ == "__main__":
# Allow running the test directly with python run_test.py
test_health_endpoint()
print("Health endpoint test passed!")