You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
40 lines
1.4 KiB
40 lines
1.4 KiB
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
|