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

96 lines
3.1 KiB
Python

#!/usr/bin/env python3
"""
Test the browser's research creation endpoint specifically
"""
from flask import json
class TestBrowserEndpoint:
"""Test browser-specific endpoints."""
def test_start_research_endpoint(self, authenticated_client):
"""Test the browser endpoint /api/start_research."""
research_data = {
"query": "Test from browser endpoint",
"mode": "quick",
"model_provider": "OLLAMA",
"model": "llama2",
"search_engine": "searxng",
"max_results": 10,
"time_period": "y",
"iterations": 1,
"questions_per_iteration": 3,
"strategy": "source-based",
"local_context": 2000,
"web_context": 2000,
"temperature": 0.7,
}
response = authenticated_client.post(
"/api/start_research",
json=research_data,
content_type="application/json",
)
assert response.status_code in [200, 202]
data = json.loads(response.data)
if response.status_code == 200:
assert data.get("status") in ["success", "processing"]
if "research_id" in data:
assert isinstance(data["research_id"], (str, int))
def test_research_status_endpoint(self, authenticated_client):
"""Test research status endpoint."""
# First create a research
# audit: PUNCHLIST reviewed 2026-05 — issue resolved by prior PR (recommendation: FIX_ASSERTION).
research_data = {
"query": "Test research for status check",
"mode": "quick",
"model_provider": "OLLAMA",
"model": "llama2",
"search_engine": "wikipedia",
"iterations": 1,
}
response = authenticated_client.post(
"/api/start_research",
json=research_data,
content_type="application/json",
)
if response.status_code == 200:
data = json.loads(response.data)
research_id = data.get("research_id")
if research_id:
# Check status
status_response = authenticated_client.get(
f"/research/api/status/{research_id}"
)
assert status_response.status_code in [200, 404]
if status_response.status_code == 200:
status_data = json.loads(status_response.data)
assert "status" in status_data
def test_endpoint_requires_authentication(self, client):
"""Test that endpoint requires authentication."""
research_data = {
"query": "Test without auth",
"mode": "quick",
}
response = client.post(
"/api/start_research",
json=research_data,
content_type="application/json",
)
# Should either redirect to login or return 401
assert response.status_code in [302, 401]
if response.status_code == 302:
assert "/auth/login" in response.location