Files
smart-management-auto-test/dulizhan/test_case/TestCase/接口/JoyHubC/JoyhubC_UserPoint.py
zhouqi 37a040c3e5 feat: 新增JoyHub C端测试用例和接口封装
1. 新增C端业务关键字层 (JoyHubC/):
   - LoginManage.py - C端登录管理
   - UserManage.py - C端用户管理
   - ProductManage.py - C端产品管理
   - BannerManage.py - C端Banner管理
   - AppVersionManage.py - C端版本管理等

2. 新增C端测试用例 (TestCase/接口/JoyHubC/):
   - JoyhubC_UserPoint.py - 用户积分测试
   - JoyhubC_Product.py - 产品测试
   - JoyhubC_Banner.py - Banner测试等

3. 接口层增强:
   - Dlizhan_interface.py 添加C端接口封装
   - 添加网易163邮箱验证码获取功能

4. 配置更新:
   - hh-qa.robot 添加C端登录配置
2026-05-13 15:56:41 +08:00

59 lines
2.5 KiB
Python
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# -*- coding:utf-8 -*-
"""
JoyHub C端查询当前用户积分接口测试用例
"""
import json
import allure
import logging
import pytest
from dulizhan.library.BusinessKw.JoyHubC.UserManage import JoyHubCUserManage
logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s')
@allure.feature("C端 - 用户模块")
class TestJoyHubCUserPoint:
login_resp = None
login_success = False
@classmethod
def setup_class(cls):
"""在整个测试类开始时先调用C端登录接口"""
logging.info("=============================================")
logging.info("=========== 开始JoyHub C端登录 =========")
logging.info("=============================================")
cls.test_case = JoyHubCUserManage()
cls.login_resp = cls.test_case.kw_joyhub_c_login()
cls.login_success = cls.test_case.joyhub_c_token is not None
assert cls.login_success is True, "JoyHub C端登录失败未获取到Token"
logging.info("JoyHub C端登录成功Token已设置")
@allure.story("验证C端登录")
@allure.title("测试C端登录")
def test_joyhub_c_login(self):
"""测试C端登录"""
assert TestJoyHubCUserPoint.login_success is True, "C端登录失败"
logging.info("C端登录验证通过")
@allure.story("验证查询当前用户积分")
@allure.title("测试查询当前用户积分接口")
@pytest.mark.skip(reason="积分接口鉴权方式与当前C端登录token不一致待确认真实鉴权头后恢复")
def test_joyhub_c_client_get_point_get(self):
"""测试查询当前用户积分接口"""
with allure.step("1. 确认C端已登录"):
assert TestJoyHubCUserPoint.login_success is True, "C端未登录无法查询当前用户积分"
with allure.step("2. 调用查询当前用户积分接口"):
resp = self.test_case.kw_joyhub_c_client_get_point_get()
allure.attach(json.dumps(resp, ensure_ascii=False, indent=2), name="响应数据", attachment_type=allure.attachment_type.JSON)
with allure.step("3. 验证响应"):
assert resp is not None, "响应为空"
assert "code" in resp, "响应中缺少code字段"
assert resp["code"] == 0, f"请求失败code={resp.get('code')}, msg={resp.get('msg')}"
assert "data" in resp, "响应中缺少data字段"
assert resp["data"] is not None, "data字段为空"
logging.info("查询当前用户积分接口验证通过")