Add the integration test.

main
KKlochko 1 month ago
parent efb3683fb7
commit 763773ee51
Signed by: KKlochko
GPG Key ID: 572ECCD219BBA91B

@ -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
Loading…
Cancel
Save