feat: 新增JoyHub模块测试用例和功能增强

1. 新增模块测试用例:
   - News分类接口测试 (Joyhub_NewsCate.py)
   - News内容接口测试 (Joyhub_News.py)
   - 产品分类接口测试 (Joyhub_ProductCate.py)
   - 产品属性接口测试 (Joyhub_ProductAttr.py)
   - 产品管理接口测试 (Joyhub_Product.py)
   - FAQ分类接口测试 (Joyhub_FaqCate.py)
   - FAQ内容接口测试 (Joyhub_Faq.py)
   - 博客分类接口测试 (Joyhub_BlogCate.py)
   - 地址国家接口测试 (Joyhub_AddressCountry.py)
   - 下载二维码接口测试 (Joyhub_DownloadQrcode.py)
   - 支付页产品推荐接口测试 (Joyhub_ProductPaymentRecommend.py)

2. 新增业务关键字层:
   - NewsCateManage.py
   - NewsManage.py
   - ProductCateManage.py
   - ProductAttrManage.py
   - ProductManage.py
   - FaqCateManage.py
   - FaqManage.py
   - BlogCateManage.py
   - AddressCountryManage.py
   - DownloadQrcodeManage.py
   - ProductPaymentRecommendManage.py

3. 接口层增强:
   - Dlizhan_interface.py 添加JoyHub相关接口封装

4. 功能增强:
   - run_tests.py 添加自动清除旧测试结果和报告功能
   - Joyhub_Product.py 添加数据库连接获取运费模板ID和品牌ID

5. 修复:
   - 修复产品创建测试用例缺少前置数据问题
This commit is contained in:
2026-05-08 18:09:48 +08:00
parent 32fd51380c
commit 3191ec4f3c
25 changed files with 4800 additions and 2 deletions

View File

@@ -0,0 +1,160 @@
# -*- coding:utf-8 -*-
"""
国家信息管理业务关键字层
"""
import allure
from dulizhan.library.Dlizhan_interface import DlzhanInterface
from base_framework.public_tools import log
obj_log = log.get_logger()
class AddressCountryManage(DlzhanInterface):
"""国家信息管理业务关键字类"""
def __init__(self):
super().__init__()
@allure.step("创建国家信息")
def kw_joyhub_address_country_create_post(self, country_code, country_name, country_name_en, phone_code,
lingxing_country_code=None, paypal_country_code=None, status=1, id=0):
"""
创建国家信息业务关键字
:param id: 主键新增为0
:param country_code: 国家代码(如 CN/US
:param country_name: 国家名称
:param country_name_en: 国家英文名称
:param phone_code: 电话区号
:param lingxing_country_code: 领星国家代码(可选)
:param paypal_country_code: paypal国家代码可选
:param status: 状态 (1正常 2停用)
:return: 响应结果
"""
obj_log.info(f"创建国家信息 - country_code: {country_code}, country_name: {country_name}, status: {status}")
params = {
"id": id,
"countryCode": country_code,
"countryName": country_name,
"countryNameEn": country_name_en,
"phoneCode": phone_code,
"status": status
}
if lingxing_country_code:
params["lingxingCountryCode"] = lingxing_country_code
if paypal_country_code:
params["paypalCountryCode"] = paypal_country_code
resp = self.kw_in_joyhub_address_country_create_post(**params)
obj_log.info(f"创建国家信息响应: {resp}")
return resp
@allure.step("删除国家信息")
def kw_joyhub_address_country_delete_delete(self, country_id):
"""
删除国家信息业务关键字
:param country_id: 国家信息ID
:return: 响应结果
"""
obj_log.info(f"删除国家信息 - country_id: {country_id}")
resp = self.kw_in_joyhub_address_country_delete_delete(country_id)
obj_log.info(f"删除国家信息响应: {resp}")
return resp
@allure.step("批量删除国家信息")
def kw_joyhub_address_country_delete_list_delete(self, country_ids):
"""
批量删除国家信息业务关键字
:param country_ids: 国家信息ID列表
:return: 响应结果
"""
obj_log.info(f"批量删除国家信息 - country_ids: {country_ids}")
resp = self.kw_in_joyhub_address_country_delete_list_delete(country_ids)
obj_log.info(f"批量删除国家信息响应: {resp}")
return resp
@allure.step("获得国家信息详情")
def kw_joyhub_address_country_get_get(self, country_id):
"""
获得国家信息详情业务关键字
:param country_id: 国家信息ID
:return: 响应结果
"""
obj_log.info(f"获得国家信息详情 - country_id: {country_id}")
resp = self.kw_in_joyhub_address_country_get_get(country_id)
obj_log.info(f"获得国家信息详情响应: {resp}")
return resp
@allure.step("获得国家信息分页")
def kw_joyhub_address_country_page_get(self, page_num=1, page_size=10, **kwargs):
"""
获得国家信息分页业务关键字
:param page_num: 页码
:param page_size: 每页大小
:param kwargs: 其他查询条件
:return: 响应结果
"""
obj_log.info(f"获得国家信息分页 - page_num: {page_num}, page_size: {page_size}")
params = {
"page": page_num,
"size": page_size
}
params.update(kwargs)
resp = self.kw_in_joyhub_address_country_page_get(**params)
obj_log.info(f"获得国家信息分页响应: {resp}")
return resp
@allure.step("更新国家信息")
def kw_joyhub_address_country_update_put(self, country_id, country_code, country_name, country_name_en, phone_code,
lingxing_country_code=None, paypal_country_code=None, status=1):
"""
更新国家信息业务关键字
:param country_id: 国家信息ID
:param country_code: 国家代码
:param country_name: 国家名称
:param country_name_en: 国家英文名称
:param phone_code: 电话区号
:param lingxing_country_code: 领星国家代码(可选)
:param paypal_country_code: paypal国家代码可选
:param status: 状态 (1正常 2停用)
:return: 响应结果
"""
obj_log.info(f"更新国家信息 - country_id: {country_id}, country_code: {country_code}, country_name: {country_name}")
params = {
"id": country_id,
"countryCode": country_code,
"countryName": country_name,
"countryNameEn": country_name_en,
"phoneCode": phone_code,
"status": status
}
if lingxing_country_code:
params["lingxingCountryCode"] = lingxing_country_code
if paypal_country_code:
params["paypalCountryCode"] = paypal_country_code
resp = self.kw_in_joyhub_address_country_update_put(**params)
obj_log.info(f"更新国家信息响应: {resp}")
return resp
@allure.step("批量更新国家信息状态")
def kw_joyhub_address_country_update_status_list_put(self, country_ids, status):
"""
批量更新国家信息状态业务关键字
:param country_ids: 国家信息ID列表
:param status: 状态 (1正常 2停用)
:return: 响应结果
"""
obj_log.info(f"批量更新国家信息状态 - country_ids: {country_ids}, status: {status}")
# 接口参数通过query传递ids需要用逗号分隔
ids_str = ','.join(map(str, country_ids))
resp = self.kw_in_joyhub_address_country_update_status_list_put(ids=ids_str, status=status)
obj_log.info(f"批量更新国家信息状态响应: {resp}")
return resp