test_01_health.py 679 B

123456789101112131415161718192021222324252627
  1. """§1 健康检查 — GET /api/health"""
  2. import pytest
  3. import requests
  4. from conftest import MOBILE_BASE, PC_BASE
  5. pytestmark = pytest.mark.integration
  6. def test_pc_health(require_pc_server):
  7. r = requests.get(f"{require_pc_server}/health", timeout=5)
  8. assert r.status_code == 200
  9. body = r.json()
  10. assert body["status"] == "ok"
  11. assert body["platform"] == "pc"
  12. assert "qiwei" in body["modules"]
  13. assert "staff" in body["modules"]
  14. def test_mobile_health():
  15. try:
  16. r = requests.get(f"{MOBILE_BASE}/health", timeout=3)
  17. except requests.RequestException:
  18. pytest.skip("Mobile 服务未启动 (3201)")
  19. assert r.status_code == 200