Round 3 fixes: cancelled polling, aggregator invalid_count, filter state, scheduler atomicity, HTTP exception handler, tests
This commit is contained in:
@@ -135,3 +135,32 @@ class TestSettingsAPI:
|
||||
# 验证一致性
|
||||
for key, value in test_settings.items():
|
||||
assert saved_settings[key] == value, f"设置项 {key} 不一致"
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_settings_roundtrip_with_validation_targets(self, client):
|
||||
"""测试设置读写一致性 - 包含数组类型的 validation_targets"""
|
||||
test_settings = {
|
||||
"crawl_timeout": 30,
|
||||
"validation_timeout": 10,
|
||||
"max_retries": 3,
|
||||
"default_concurrency": 50,
|
||||
"min_proxy_score": 0,
|
||||
"proxy_expiry_days": 7,
|
||||
"auto_validate": True,
|
||||
"validate_interval_minutes": 30,
|
||||
"validation_targets": [
|
||||
"http://example.com/1",
|
||||
"https://example.com/2",
|
||||
],
|
||||
}
|
||||
|
||||
# 写入设置
|
||||
response = await client.post("/api/settings", json=test_settings)
|
||||
assert response.status_code == 200
|
||||
data = response.json()
|
||||
assert data["data"]["validation_targets"] == test_settings["validation_targets"]
|
||||
|
||||
# 读取设置
|
||||
response = await client.get("/api/settings")
|
||||
saved_settings = response.json()["data"]
|
||||
assert saved_settings["validation_targets"] == test_settings["validation_targets"]
|
||||
|
||||
Reference in New Issue
Block a user