test_13_qiwei_live.py 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. """QiWe 模块 — 真实联调(proxy / sync / 在线状态)"""
  2. import pytest
  3. pytestmark = [pytest.mark.integration, pytest.mark.qiwei_live]
  4. def test_live_check_login(api, live_guid):
  5. data = api.assert_success(api.get(f"/qiwei/staff/{live_guid}/status"))
  6. assert data.get("guid") == live_guid or data.get("userId")
  7. assert data["userOnlineStatus"] in (1, 2)
  8. assert data.get("nickname") or data.get("userId")
  9. def test_live_proxy_get_room_list(api, live_guid):
  10. data = api.assert_success(
  11. api.post(
  12. "/qiwei/proxy",
  13. json={
  14. "method": "/room/getRoomList",
  15. "params": {"guid": live_guid, "nextStartIndex": 0},
  16. },
  17. )
  18. )
  19. assert isinstance(data, dict)
  20. assert "roomList" in data or "roomCount" in data
  21. def test_live_sync_messages(api, live_guid):
  22. data = api.assert_success(
  23. api.post("/qiwei/sync", json={"guid": live_guid, "msgSeq": 0, "limit": 20})
  24. )
  25. assert "messages" in data
  26. assert "hasMore" in data
  27. def test_live_batch_status(api, live_guid):
  28. data = api.assert_success(
  29. api.post("/qiwei/staff/batch-status", json={"guids": [live_guid]})
  30. )
  31. assert len(data) == 1
  32. assert data[0].get("guid") == live_guid or data[0].get("userId")