Files
wehub-resource-sync 7a0da7932b
Backwards Compatibility / Verify Encryption Constants (push) Waiting to run
Backwards Compatibility / PyPI Version Compatibility (push) Waiting to run
Backwards Compatibility / Database Migration Tests (push) Waiting to run
CodeQL Advanced / Analyze (javascript-typescript) (push) Waiting to run
CodeQL Advanced / Analyze (python) (push) Waiting to run
Docker Tests (Consolidated) / UI Tests (Puppeteer) [research-form] (push) Blocked by required conditions
Docker Tests (Consolidated) / UI Tests (Puppeteer) [research-metrics] (push) Blocked by required conditions
Docker Tests (Consolidated) / UI Tests (Puppeteer) [research-workflow] (push) Blocked by required conditions
Docker Tests (Consolidated) / UI Tests (Puppeteer) [settings-core] (push) Blocked by required conditions
Docker Tests (Consolidated) / UI Tests (Puppeteer) [settings-pages] (push) Blocked by required conditions
Docker Tests (Consolidated) / UI Tests (Puppeteer) [history-news] (push) Blocked by required conditions
Docker Tests (Consolidated) / UI Tests (Puppeteer) [library] (push) Blocked by required conditions
Docker Tests (Consolidated) / UI Tests (Puppeteer) [link-analytics] (push) Blocked by required conditions
Docker Tests (Consolidated) / UI Tests (Puppeteer) [mobile] (push) Blocked by required conditions
Docker Tests (Consolidated) / detect-changes (push) Waiting to run
Docker Tests (Consolidated) / Build Test Image (push) Waiting to run
Docker Tests (Consolidated) / All Pytest Tests + Coverage (push) Blocked by required conditions
Docker Tests (Consolidated) / UI Tests (Puppeteer) [accessibility] (push) Blocked by required conditions
Docker Tests (Consolidated) / UI Tests (Puppeteer) [api-crud] (push) Blocked by required conditions
Docker Tests (Consolidated) / UI Tests (Puppeteer) [auth-login] (push) Blocked by required conditions
Docker Tests (Consolidated) / UI Tests (Puppeteer) [auth-pages] (push) Blocked by required conditions
Docker Tests (Consolidated) / UI Tests (Puppeteer) [auth-register] (push) Blocked by required conditions
Docker Tests (Consolidated) / UI Tests (Puppeteer) [chat-core] (push) Blocked by required conditions
Docker Tests (Consolidated) / UI Tests (Puppeteer) [chat-lifecycle] (push) Blocked by required conditions
Docker Tests (Consolidated) / UI Tests (Puppeteer) [error-benchmark] (push) Blocked by required conditions
Docker Tests (Consolidated) / UI Tests (Puppeteer) (push) Blocked by required conditions
Docker Tests (Consolidated) / Accessibility Tests (push) Blocked by required conditions
Docker Tests (Consolidated) / LLM Unit Tests (push) Blocked by required conditions
Docker Tests (Consolidated) / LLM Example Tests (push) Blocked by required conditions
Docker Tests (Consolidated) / Production Image Smoke Test (push) Blocked by required conditions
Docker Tests (Consolidated) / Infrastructure Tests (push) Blocked by required conditions
OSSF Scorecard / OSSF Security Scorecard Analysis (push) Waiting to run
OSV-Scanner (Scheduled) / scan-scheduled (push) Failing after 0s
Create Release / test-gate (push) Has been cancelled
Create Release / release-gate (push) Has been cancelled
Create Release / ci-gate (push) Has been cancelled
Create Release / version-check (push) Has been cancelled
Create Release / e2e-test-gate (push) Has been cancelled
Create Release / responsive-test-gate (push) Has been cancelled
Create Release / compat-test-gate (push) Has been cancelled
Create Release / compose-integration-gate (push) Has been cancelled
Create Release / vulture-gate (push) Has been cancelled
Create Release / build (push) Has been cancelled
Create Release / provenance (push) Has been cancelled
Create Release / prerelease-docker (push) Has been cancelled
Create Release / publish-docker (push) Has been cancelled
Create Release / create-release (push) Has been cancelled
Create Release / cleanup-changelog (push) Has been cancelled
Create Release / trigger-pypi (push) Has been cancelled
Create Release / monitor-pypi (push) Has been cancelled
Create Release / Clean up orphan prerelease tags and signatures (push) Has been cancelled
chore: import upstream snapshot with attribution
2026-07-13 13:08:55 +08:00

131 lines
4.4 KiB
Python

"""
Simple REST API tests with ultra-minimal queries and longer timeouts.
Focus on basic functionality verification.
"""
import json
import pytest
# Extended timeout for research operations
RESEARCH_TIMEOUT = 120 # 2 minutes
class TestRestAPISimple:
"""Simple REST API tests."""
def test_health_and_docs(self, authenticated_client):
"""Test basic non-research endpoints."""
print("🔍 Testing health and documentation endpoints...")
# Health check
response = authenticated_client.get("/api/v1/health")
assert response.status_code == 200
data = json.loads(response.data)
assert data["status"] == "ok"
print("✅ Health check passed")
# API documentation (requires auth)
response = authenticated_client.get("/api/v1/")
assert response.status_code == 200
data = json.loads(response.data)
assert data["api_version"] == "v1"
assert "endpoints" in data
print("✅ API documentation passed")
def test_error_handling(self, authenticated_client):
"""Test error handling for malformed requests."""
print("🔍 Testing error handling...")
# Missing query parameter
response = authenticated_client.post(
"/api/v1/quick_summary",
json={},
content_type="application/json",
)
assert response.status_code == 400
data = json.loads(response.data)
assert "error" in data
print("✅ Error handling for missing query passed")
# Missing parameters for analyze_documents
response = authenticated_client.post(
"/api/v1/analyze_documents",
json={"query": "test"},
content_type="application/json",
)
assert response.status_code == 400
data = json.loads(response.data)
assert "error" in data
print("✅ Error handling for missing collection_name passed")
@pytest.mark.requires_llm
def test_quick_summary_ultra_minimal(self, authenticated_client):
"""Test quick summary with the most minimal possible query."""
print("🔍 Testing quick summary with ultra-minimal query...")
payload = {
"query": "cat", # Single word, very common
"search_tool": "wikipedia",
"iterations": 1,
"temperature": 0.7,
}
print("Making request...")
response = authenticated_client.post(
"/api/v1/quick_summary",
json=payload,
content_type="application/json",
)
if response.status_code == 200:
data = json.loads(response.data)
# Basic structure validation
required_fields = ["query", "summary", "findings"]
for field in required_fields:
assert field in data, f"Missing field: {field}"
assert data["query"] == "cat"
assert len(data["summary"]) > 0, "Summary should not be empty"
assert isinstance(data["findings"], list), (
"Findings should be a list"
)
print(
f"✅ Quick summary passed - got {len(data['summary'])} chars of summary"
)
print(f" Found {len(data['findings'])} findings")
else:
pytest.fail(
f"Quick summary failed with status {response.status_code}"
)
print(f" Response: {response.data[:200]}")
@pytest.mark.requires_llm
def test_generate_report_minimal(self, authenticated_client):
"""Test generate report with minimal input."""
print("🔍 Testing generate report with minimal input...")
payload = {
"query": "Sun",
"research_type": "quick",
}
response = authenticated_client.post(
"/api/v1/generate_report",
json=payload,
content_type="application/json",
)
# This endpoint might not be fully implemented
if response.status_code == 200:
print("✅ Generate report passed")
elif response.status_code in [404, 500]:
print(
f"⚠️ Generate report endpoint not fully implemented ({response.status_code})"
)
else:
pytest.fail(
f"Generate report failed with unexpected status {response.status_code}"
)