test(ECR-009): 补页面/API 路由冒烟与 TEST_REPORT
交付前缺 Flask 常驻与路由断言;现补齐 pytest 与报告。 Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -0,0 +1,25 @@
|
|||||||
|
# TEST_REPORT — ECR-009
|
||||||
|
|
||||||
|
**Date:** 2026-08-07
|
||||||
|
|
||||||
|
## Commands
|
||||||
|
|
||||||
|
```bash
|
||||||
|
PYTHONPATH=. python -m pytest tests/test_crypto_wyckoff_decision.py -q
|
||||||
|
CRYPTO_WYCKOFF_DISABLE=1 PYTHONPATH=.:web python -m pytest web/tests/test_wyckoff_crypto_routes.py -q
|
||||||
|
# Manual / live:
|
||||||
|
# cd web && CRYPTO_WYCKOFF_MAX_SYMBOLS=5 PYTHONPATH=..:. python app.py
|
||||||
|
# curl -I http://127.0.0.1:8128/wyckoff_crypto
|
||||||
|
```
|
||||||
|
|
||||||
|
## Result
|
||||||
|
|
||||||
|
| Check | Result |
|
||||||
|
|-------|--------|
|
||||||
|
| Decision gate unit | 2 passed |
|
||||||
|
| Route page/meta/scan | 补测(本文件) |
|
||||||
|
| Live HTTP 2026-08-07 | `GET /wyckoff_crypto` → 200(需先启动 web) |
|
||||||
|
|
||||||
|
## Note
|
||||||
|
|
||||||
|
此前冒烟只做了引擎 tick,**未**在交付前保持 Flask 常驻并给浏览器 URL——属 ESS 测试缺口,已补路由测试与本报告。
|
||||||
@@ -0,0 +1,48 @@
|
|||||||
|
"""ECR-009: page/API smoke without requiring live provider during assert."""
|
||||||
|
|
||||||
|
from __future__ import annotations
|
||||||
|
|
||||||
|
import os
|
||||||
|
import sys
|
||||||
|
|
||||||
|
import pytest
|
||||||
|
|
||||||
|
# Ensure repo root + web on path like app.py
|
||||||
|
_ROOT = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
|
||||||
|
_WEB = os.path.join(_ROOT, "web")
|
||||||
|
for p in (_ROOT, _WEB):
|
||||||
|
if p not in sys.path:
|
||||||
|
sys.path.insert(0, p)
|
||||||
|
|
||||||
|
os.environ.setdefault("CRYPTO_WYCKOFF_DISABLE", "1")
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.fixture()
|
||||||
|
def client():
|
||||||
|
from app import create_app
|
||||||
|
|
||||||
|
app = create_app()
|
||||||
|
app.config["TESTING"] = True
|
||||||
|
with app.test_client() as c:
|
||||||
|
yield c
|
||||||
|
|
||||||
|
|
||||||
|
def test_wyckoff_crypto_page_ok(client):
|
||||||
|
resp = client.get("/wyckoff_crypto")
|
||||||
|
assert resp.status_code == 200
|
||||||
|
assert b"Crypto Wyckoff Screener" in resp.data
|
||||||
|
|
||||||
|
|
||||||
|
def test_wyckoff_crypto_meta_ok(client):
|
||||||
|
resp = client.get("/api/wyckoff_crypto/meta")
|
||||||
|
assert resp.status_code == 200
|
||||||
|
data = resp.get_json()
|
||||||
|
assert "engine_version" in data
|
||||||
|
assert data.get("timeframes") == ["1d", "1w", "1M"]
|
||||||
|
|
||||||
|
|
||||||
|
def test_wyckoff_crypto_scan_ok(client):
|
||||||
|
resp = client.get("/api/wyckoff_crypto/scan?limit=5")
|
||||||
|
assert resp.status_code == 200
|
||||||
|
data = resp.get_json()
|
||||||
|
assert "rows" in data
|
||||||
Reference in New Issue
Block a user