zbsousuo.py 1.0 KB

123456789101112131415161718192021222324252627282930313233
  1. from hytest import *
  2. from lib.webapi import apimgr
  3. class c1:
  4. name = '我的'
  5. def teststeps(self):
  6. INFO('测试步骤')
  7. # STEP 1: 调用小程序登录接口,获取 cookies
  8. STEP(1, '调用小程序登录接口获取 cookies')
  9. try:
  10. apimgr.mgr_get_cookie(phone='15037870765', token='8817684142977367381')
  11. INFO('Cookies 获取成功')
  12. except Exception as e:
  13. INFO(f'获取 Cookies 失败: {e}')
  14. raise
  15. # STEP 2: 调用获取订单详情接口
  16. STEP(2, '调用获取订单详情接口')
  17. try:
  18. res = apimgr.debrisproduct_orderDetail(order_id='12345')
  19. r = res.json()
  20. INFO(r)
  21. except Exception as e:
  22. INFO(f'调用订单详情接口失败: {e}')
  23. raise
  24. # STEP 3: 设置检查点
  25. STEP(3, '设置检查点')
  26. actual_error_code = r.get('error_code')
  27. CHECK_POINT('检查获取订单详情接口是否正常', actual_error_code == 0)