"""T4.11 多源数据接入测试。""" import pytest from fastapi.testclient import TestClient class TestDataSources: """数据源管理接口测试。""" def test_list_empty(self, client: TestClient, auth_headers: dict): """无数据源时应返回空列表。""" resp = client.get("/api/v1/data-sources", headers=auth_headers) assert resp.status_code == 200 assert isinstance(resp.json()["data"], list) def test_list_with_company_filter(self, client: TestClient, auth_headers: dict, company_id: str): """指定企业 ID 过滤。""" resp = client.get(f"/api/v1/data-sources?company_id={company_id}", headers=auth_headers) assert resp.status_code == 200 def test_list_no_auth(self, client: TestClient): """未认证应返回 401。""" resp = client.get("/api/v1/data-sources") assert resp.status_code == 401