diff --git a/tests/test_integration.py b/tests/test_integration.py new file mode 100644 index 0000000..477d46a --- /dev/null +++ b/tests/test_integration.py @@ -0,0 +1,39 @@ +import pytest +import requests +from typing import Dict, Any +from .conftest import BASE_URL + + +class TestIntegration: + """Integration tests""" + + def test_full_workflow(self, api_client): + """Test a workflow that use all endpoints""" + + # Health check + health = api_client.get(f"{BASE_URL}/health") + assert health.status_code == 200 + assert health.content == b'{"status":"healthy","model_loaded":true}' + + # Extract entities + general_payload = { + "text": "Apple Inc. was founded by Steve Jobs in California.", + "entities": ["organization", "person", "location"] + } + general_response = api_client.post(f"{BASE_URL}/general", json=general_payload) + assert general_response.status_code == 200 + + # Extract relations + relation_payload = { + "text": "Apple Inc. was founded by Steve Jobs in California.", + "relations": ["founded_by", "located_in"] + } + relation_response = api_client.post(f"{BASE_URL}/relation-extraction", json=relation_payload) + assert relation_response.status_code == 200 + + # Summarization + summary_payload = { + "text": "Apple Inc. was founded by Steve Jobs in California. The company revolutionized technology." + } + summary_response = api_client.post(f"{BASE_URL}/summarization", json=summary_payload) + assert summary_response.status_code == 200