test_live_t01.py 806 B

123456789101112131415161718192021222324
  1. # tests/test_live_t01.py
  2. """Task 8: [live] T01 端到端 — 无客户端创角(逐鹿05区 14481607)。
  3. 默认跳过(pytest.ini addopts -m "not live");真实网关显式:
  4. protocol_bot/.venv/bin/python -m pytest tests/test_live_t01.py -m live -v -s
  5. """
  6. import random
  7. import pytest
  8. from apilot.host import Host
  9. pytestmark = pytest.mark.live
  10. def test_t01_create_role_headless():
  11. name = "萌新" + str(random.randint(1000, 9999))
  12. h = Host(14481607, "longwu988", "Longwu1988", state_dir="/tmp/apilot_t01")
  13. h.http_login()
  14. h.boot_lua()
  15. result = h.run_create_role(name=name) # 内部: connect→2001链→101→521
  16. assert result["role_name"] == name
  17. assert result["ticket"] # 521 票据非空
  18. assert h.nc.get_sdata() != 0 # 530 sid 已注入