"""T4.12 行业研究自动化测试。""" import pytest from fastapi.testclient import TestClient class TestIndustryResearch: """行业研究接口测试。""" def test_research_success(self, client: TestClient, auth_headers: dict): """AI 行业研究。""" resp = client.post( "/api/v1/industry-research/research", json={"industry": "AI 教育", "companies": "学而思, 猿辅导, 作业帮"}, headers=auth_headers, ) assert resp.status_code == 200 assert isinstance(resp.json()["data"], dict) def test_research_no_auth(self, client: TestClient): """未认证应返回 401。""" resp = client.post("/api/v1/industry-research/research", json={}) assert resp.status_code == 401 def test_research_empty(self, client: TestClient, auth_headers: dict): """空输入应正常返回。""" resp = client.post( "/api/v1/industry-research/research", json={"industry": "", "companies": ""}, headers=auth_headers, ) assert resp.status_code == 200