feat: 新增JoyHub协议管理和app版本号管理接口测试用例
This commit is contained in:
153
dulizhan/library/BusinessKw/JoyHub/AgreementManage.py
Normal file
153
dulizhan/library/BusinessKw/JoyHub/AgreementManage.py
Normal file
@@ -0,0 +1,153 @@
|
||||
# -*- coding:utf-8 -*-
|
||||
import os
|
||||
import sys
|
||||
|
||||
current_file_path = os.path.abspath(__file__)
|
||||
project_root = os.path.abspath(os.path.join(os.path.dirname(current_file_path), '../../../'))
|
||||
if project_root not in sys.path:
|
||||
sys.path.insert(0, project_root)
|
||||
|
||||
from dulizhan.library.Dlizhan_interface import DlzhanInterface
|
||||
from base_framework.public_tools import log
|
||||
import allure
|
||||
|
||||
obj_log = log.get_logger()
|
||||
|
||||
|
||||
class AgreementManage(DlzhanInterface):
|
||||
def __init__(self):
|
||||
super().__init__()
|
||||
|
||||
@allure.step("创建协议")
|
||||
def kw_joyhub_agreement_create_post(self, type, title, content, terminal="web", lang="en", rank_num=1, status=1, id=0):
|
||||
"""
|
||||
创建协议业务关键字
|
||||
:param id: 主键,新增为0
|
||||
:param type: 类型(1隐私协议 2用户协议)
|
||||
:param title: 标题
|
||||
:param content: 内容
|
||||
:param terminal: 终端(1web 2app)
|
||||
:param lang: 语言 (en 英语 de 德语 ja 日语)
|
||||
:param rank_num: 排序号
|
||||
:param status: 状态 (1正常 2停用)
|
||||
:return: 响应结果
|
||||
"""
|
||||
obj_log.info(f"创建协议 - type: {type}, title: {title}, content: {content[:50]}..., terminal: {terminal}, lang: {lang}, rank_num: {rank_num}, status: {status}")
|
||||
|
||||
params = {
|
||||
"id": id,
|
||||
"type": type,
|
||||
"title": title,
|
||||
"content": content,
|
||||
"terminal": terminal,
|
||||
"lang": lang,
|
||||
"rankNum": rank_num,
|
||||
"status": status
|
||||
}
|
||||
|
||||
resp = self.kw_in_joyhub_agreement_create_post(**params)
|
||||
obj_log.info(f"创建协议响应: {resp}")
|
||||
|
||||
return resp
|
||||
|
||||
@allure.step("删除协议")
|
||||
def kw_joyhub_agreement_delete_delete(self, agreement_id):
|
||||
"""
|
||||
删除协议业务关键字
|
||||
:param agreement_id: 协议ID
|
||||
:return: 响应结果
|
||||
"""
|
||||
obj_log.info(f"删除协议 - agreement_id: {agreement_id}")
|
||||
|
||||
resp = self.kw_in_joyhub_agreement_delete_delete(agreement_id)
|
||||
obj_log.info(f"删除协议响应: {resp}")
|
||||
|
||||
return resp
|
||||
|
||||
@allure.step("批量删除协议")
|
||||
def kw_joyhub_agreement_delete_list_delete(self, agreement_ids):
|
||||
"""
|
||||
批量删除协议业务关键字
|
||||
:param agreement_ids: 协议ID列表
|
||||
:return: 响应结果
|
||||
"""
|
||||
obj_log.info(f"批量删除协议 - agreement_ids: {agreement_ids}")
|
||||
|
||||
resp = self.kw_in_joyhub_agreement_delete_list_delete(agreement_ids)
|
||||
obj_log.info(f"批量删除协议响应: {resp}")
|
||||
|
||||
return resp
|
||||
|
||||
@allure.step("导出协议Excel")
|
||||
def kw_joyhub_agreement_export_excel_get(self, **kwargs):
|
||||
"""
|
||||
导出协议Excel业务关键字
|
||||
:param kwargs: 查询参数(type, title, content, status)
|
||||
:return: 响应结果
|
||||
"""
|
||||
obj_log.info(f"导出协议Excel - 参数: {kwargs}")
|
||||
|
||||
resp = self.kw_in_joyhub_agreement_export_excel_get(**kwargs)
|
||||
obj_log.info(f"导出协议Excel响应: {resp}")
|
||||
|
||||
return resp
|
||||
|
||||
@allure.step("获得协议详情")
|
||||
def kw_joyhub_agreement_get_get(self, agreement_id):
|
||||
"""
|
||||
获得协议详情业务关键字
|
||||
:param agreement_id: 协议ID
|
||||
:return: 响应结果
|
||||
"""
|
||||
obj_log.info(f"获得协议详情 - agreement_id: {agreement_id}")
|
||||
|
||||
resp = self.kw_in_joyhub_agreement_get_get(agreement_id)
|
||||
obj_log.info(f"获得协议详情响应: {resp}")
|
||||
|
||||
return resp
|
||||
|
||||
@allure.step("获得协议分页列表")
|
||||
def kw_joyhub_agreement_page_get(self, **kwargs):
|
||||
"""
|
||||
获得协议分页列表业务关键字
|
||||
:param kwargs: 查询参数(type, title, content, status, page_no, page_size)
|
||||
:return: 响应结果
|
||||
"""
|
||||
obj_log.info(f"获得协议分页列表 - 参数: {kwargs}")
|
||||
|
||||
resp = self.kw_in_joyhub_agreement_page_get(**kwargs)
|
||||
obj_log.info(f"获得协议分页列表响应: {resp}")
|
||||
|
||||
return resp
|
||||
|
||||
@allure.step("更新协议")
|
||||
def kw_joyhub_agreement_update_put(self, agreement_id, type, title, content, terminal="web", lang="en", rank_num=1, status=1):
|
||||
"""
|
||||
更新协议业务关键字
|
||||
:param agreement_id: 协议ID
|
||||
:param type: 类型(1隐私协议 2用户协议)
|
||||
:param title: 标题
|
||||
:param content: 内容
|
||||
:param terminal: 终端(1web 2app)
|
||||
:param lang: 语言 (en 英语 de 德语 ja 日语)
|
||||
:param rank_num: 排序号
|
||||
:param status: 状态 (1正常 2停用)
|
||||
:return: 响应结果
|
||||
"""
|
||||
obj_log.info(f"更新协议 - agreement_id: {agreement_id}, type: {type}, title: {title}, content: {content[:50]}..., terminal: {terminal}, lang: {lang}, rank_num: {rank_num}, status: {status}")
|
||||
|
||||
params = {
|
||||
"id": agreement_id,
|
||||
"type": type,
|
||||
"title": title,
|
||||
"content": content,
|
||||
"terminal": terminal,
|
||||
"lang": lang,
|
||||
"rankNum": rank_num,
|
||||
"status": status
|
||||
}
|
||||
|
||||
resp = self.kw_in_joyhub_agreement_update_put(**params)
|
||||
obj_log.info(f"更新协议响应: {resp}")
|
||||
|
||||
return resp
|
||||
202
dulizhan/library/BusinessKw/JoyHub/AppVersionManage.py
Normal file
202
dulizhan/library/BusinessKw/JoyHub/AppVersionManage.py
Normal file
@@ -0,0 +1,202 @@
|
||||
import logging
|
||||
import allure
|
||||
from dulizhan.library.Dlizhan_interface import DlzhanInterface
|
||||
|
||||
obj_log = logging.getLogger("logger")
|
||||
|
||||
|
||||
class AppVersionManage(DlzhanInterface):
|
||||
def __init__(self):
|
||||
super().__init__()
|
||||
|
||||
@allure.step("创建app版本号")
|
||||
def kw_joyhub_appversion_create_post(self, store_name, version, download_url, is_on, status, id=0):
|
||||
"""
|
||||
创建app版本号管理业务关键字
|
||||
:param id: 主键,新增为0
|
||||
:param store_name: 应用商店
|
||||
:param version: 版本号
|
||||
:param download_url: 商城下载地址
|
||||
:param is_on: 是否上架(1是,2否)
|
||||
:param status: 状态 (1正常 2停用)
|
||||
:return: 响应结果
|
||||
"""
|
||||
obj_log.info(f"创建app版本号 - storeName: {store_name}, version: {version}, downloadUrl: {download_url}, isOn: {is_on}, status: {status}")
|
||||
|
||||
params = {
|
||||
"id": id,
|
||||
"storeName": store_name,
|
||||
"version": version,
|
||||
"downloadUrl": download_url,
|
||||
"isOn": is_on,
|
||||
"status": status
|
||||
}
|
||||
|
||||
resp = self.kw_in_joyhub_appversion_create_post(**params)
|
||||
obj_log.info(f"创建app版本号响应: {resp}")
|
||||
|
||||
return resp
|
||||
|
||||
@allure.step("删除app版本号")
|
||||
def kw_joyhub_appversion_delete_delete(self, appversion_id):
|
||||
"""
|
||||
删除app版本号管理业务关键字
|
||||
:param appversion_id: app版本号编号
|
||||
:return: 响应结果
|
||||
"""
|
||||
obj_log.info(f"删除app版本号 - id: {appversion_id}")
|
||||
|
||||
resp = self.kw_in_joyhub_appversion_delete_delete(appversion_id=appversion_id)
|
||||
obj_log.info(f"删除app版本号响应: {resp}")
|
||||
|
||||
return resp
|
||||
|
||||
@allure.step("批量删除app版本号")
|
||||
def kw_joyhub_appversion_delete_list_delete(self, appversion_ids):
|
||||
"""
|
||||
批量删除app版本号管理业务关键字
|
||||
:param appversion_ids: app版本号编号列表
|
||||
:return: 响应结果
|
||||
"""
|
||||
obj_log.info(f"批量删除app版本号 - ids: {appversion_ids}")
|
||||
|
||||
resp = self.kw_in_joyhub_appversion_delete_list_delete(ids=appversion_ids)
|
||||
obj_log.info(f"批量删除app版本号响应: {resp}")
|
||||
|
||||
return resp
|
||||
|
||||
@allure.step("导出app版本号Excel")
|
||||
def kw_joyhub_appversion_export_excel_get(self, page_no=1, page_size=10, **kwargs):
|
||||
"""
|
||||
导出app版本号管理 Excel业务关键字
|
||||
:param page_no: 页码
|
||||
:param page_size: 每页条数
|
||||
:param store_name: 应用商店
|
||||
:param version: 版本号
|
||||
:param download_url: 商城下载地址
|
||||
:param is_on: 是否上架
|
||||
:param status: 状态
|
||||
:return: 响应结果
|
||||
"""
|
||||
obj_log.info(f"导出app版本号Excel - pageNo: {page_no}, pageSize: {page_size}")
|
||||
|
||||
params = {
|
||||
"pageNo": page_no,
|
||||
"pageSize": page_size,
|
||||
"storeName": kwargs.get("store_name", ""),
|
||||
"version": kwargs.get("version", ""),
|
||||
"downloadUrl": kwargs.get("download_url", ""),
|
||||
"isOn": kwargs.get("is_on", ""),
|
||||
"status": kwargs.get("status", "")
|
||||
}
|
||||
|
||||
resp = self.kw_in_joyhub_appversion_export_excel_get(**params)
|
||||
obj_log.info(f"导出app版本号Excel响应: {resp}")
|
||||
|
||||
return resp
|
||||
|
||||
@allure.step("获得app版本号详情")
|
||||
def kw_joyhub_appversion_get_get(self, appversion_id):
|
||||
"""
|
||||
获得app版本号管理业务关键字
|
||||
:param appversion_id: app版本号编号
|
||||
:return: 响应结果
|
||||
"""
|
||||
obj_log.info(f"获得app版本号详情 - id: {appversion_id}")
|
||||
|
||||
resp = self.kw_in_joyhub_appversion_get_get(appversion_id=appversion_id)
|
||||
obj_log.info(f"获得app版本号详情响应: {resp}")
|
||||
|
||||
return resp
|
||||
|
||||
@allure.step("获得导入app版本号模板")
|
||||
def kw_joyhub_appversion_get_import_template_get(self):
|
||||
"""
|
||||
获得导入app版本号管理模板业务关键字
|
||||
:return: 响应结果
|
||||
"""
|
||||
obj_log.info("获得导入app版本号模板")
|
||||
|
||||
resp = self.kw_in_joyhub_appversion_get_import_template_get()
|
||||
obj_log.info(f"获得导入app版本号模板响应: {resp}")
|
||||
|
||||
return resp
|
||||
|
||||
@allure.step("导入app版本号Excel")
|
||||
def kw_joyhub_appversion_import_excel_post(self, update_support, user_id=None):
|
||||
"""
|
||||
导入app版本号管理Excel业务关键字
|
||||
:param update_support: 是否支持更新
|
||||
:param user_id: 创建人-为空则取当前人
|
||||
:return: 响应结果
|
||||
"""
|
||||
obj_log.info(f"导入app版本号Excel - updateSupport: {update_support}, userId: {user_id}")
|
||||
|
||||
params = {
|
||||
"updateSupport": update_support
|
||||
}
|
||||
if user_id is not None:
|
||||
params["userId"] = user_id
|
||||
|
||||
resp = self.kw_in_joyhub_appversion_import_excel_post(**params)
|
||||
obj_log.info(f"导入app版本号Excel响应: {resp}")
|
||||
|
||||
return resp
|
||||
|
||||
@allure.step("获得app版本号分页列表")
|
||||
def kw_joyhub_appversion_page_get(self, page_no=1, page_size=10, **kwargs):
|
||||
"""
|
||||
获得app版本号管理分页业务关键字
|
||||
:param page_no: 页码
|
||||
:param page_size: 每页条数
|
||||
:param store_name: 应用商店
|
||||
:param version: 版本号
|
||||
:param download_url: 商城下载地址
|
||||
:param is_on: 是否上架
|
||||
:param status: 状态
|
||||
:return: 响应结果
|
||||
"""
|
||||
obj_log.info(f"获得app版本号分页列表 - pageNo: {page_no}, pageSize: {page_size}")
|
||||
|
||||
params = {
|
||||
"pageNo": page_no,
|
||||
"pageSize": page_size,
|
||||
"storeName": kwargs.get("store_name", ""),
|
||||
"version": kwargs.get("version", ""),
|
||||
"downloadUrl": kwargs.get("download_url", ""),
|
||||
"isOn": kwargs.get("is_on", ""),
|
||||
"status": kwargs.get("status", "")
|
||||
}
|
||||
|
||||
resp = self.kw_in_joyhub_appversion_page_get(**params)
|
||||
obj_log.info(f"获得app版本号分页列表响应: {resp}")
|
||||
|
||||
return resp
|
||||
|
||||
@allure.step("更新app版本号")
|
||||
def kw_joyhub_appversion_update_put(self, appversion_id, store_name, version, download_url, is_on, status):
|
||||
"""
|
||||
更新app版本号管理业务关键字
|
||||
:param appversion_id: 主键
|
||||
:param store_name: 应用商店
|
||||
:param version: 版本号
|
||||
:param download_url: 商城下载地址
|
||||
:param is_on: 是否上架(1是,2否)
|
||||
:param status: 状态 (1正常 2停用)
|
||||
:return: 响应结果
|
||||
"""
|
||||
obj_log.info(f"更新app版本号 - id: {appversion_id}, storeName: {store_name}, version: {version}, downloadUrl: {download_url}, isOn: {is_on}, status: {status}")
|
||||
|
||||
params = {
|
||||
"id": appversion_id,
|
||||
"storeName": store_name,
|
||||
"version": version,
|
||||
"downloadUrl": download_url,
|
||||
"isOn": is_on,
|
||||
"status": status
|
||||
}
|
||||
|
||||
resp = self.kw_in_joyhub_appversion_update_put(**params)
|
||||
obj_log.info(f"更新app版本号响应: {resp}")
|
||||
|
||||
return resp
|
||||
@@ -39,7 +39,7 @@ class DlzhanInterface:
|
||||
def set_joyhub_token(self, token):
|
||||
self.token = token
|
||||
|
||||
def _joyhub_request(self, method, path, is_check='', note='', **kwargs):
|
||||
def _joyhub_request(self, method, path, is_check='', note='', return_json=True, **kwargs):
|
||||
url = "{}{}".format(self.joyhub_domain, path)
|
||||
headers = self._get_joyhub_headers()
|
||||
obj_log.info("=========== {} ===========".format(note or path))
|
||||
@@ -58,7 +58,11 @@ class DlzhanInterface:
|
||||
|
||||
resp = req_map.get(method.upper(), lambda: None)()
|
||||
self._check_resp(is_check, resp)
|
||||
return resp.json()
|
||||
|
||||
if return_json:
|
||||
return resp.json()
|
||||
else:
|
||||
return resp
|
||||
|
||||
def _clear_user_fingerprint(self, username):
|
||||
try:
|
||||
@@ -251,7 +255,7 @@ class DlzhanInterface:
|
||||
return self._joyhub_request('DELETE', f'/admin-api/jh/banner/delete-list?ids={ids_str}', is_check, '批量删除Banner管理')
|
||||
|
||||
def kw_in_joyhub_banner_get_import_template_get(self, is_check=''):
|
||||
return self._joyhub_request('GET', '/admin-api/jh/banner/get-import-template', is_check, '获得导入Banner管理模板')
|
||||
return self._joyhub_request('GET', '/admin-api/jh/banner/get-import-template', is_check, '获得导入Banner管理模板', return_json=False)
|
||||
|
||||
def kw_in_joyhub_banner_get_get(self, banner_id, is_check=''):
|
||||
return self._joyhub_request('GET', f'/admin-api/jh/banner/get?id={banner_id}', is_check, '获得Banner管理详情')
|
||||
@@ -262,6 +266,35 @@ class DlzhanInterface:
|
||||
def kw_in_joyhub_banner_update_put(self, is_check='', **kwargs):
|
||||
return self._joyhub_request('PUT', '/admin-api/jh/banner/update', is_check, '更新Banner管理', **kwargs)
|
||||
|
||||
# ============ app版本号管理接口 ============
|
||||
def kw_in_joyhub_appversion_create_post(self, is_check='', **kwargs):
|
||||
return self._joyhub_request('POST', '/admin-api/jh/appversion/create', is_check, '创建app版本号管理', **kwargs)
|
||||
|
||||
def kw_in_joyhub_appversion_delete_delete(self, appversion_id, is_check=''):
|
||||
return self._joyhub_request('DELETE', f'/admin-api/jh/appversion/delete?id={appversion_id}', is_check, '删除app版本号管理')
|
||||
|
||||
def kw_in_joyhub_appversion_delete_list_delete(self, ids, is_check=''):
|
||||
ids_str = ','.join(map(str, ids))
|
||||
return self._joyhub_request('DELETE', f'/admin-api/jh/appversion/delete-list?ids={ids_str}', is_check, '批量删除app版本号管理')
|
||||
|
||||
def kw_in_joyhub_appversion_export_excel_get(self, is_check='', **kwargs):
|
||||
return self._joyhub_request('GET', '/admin-api/jh/appversion/export-excel', is_check, '导出app版本号管理 Excel', return_json=False, **kwargs)
|
||||
|
||||
def kw_in_joyhub_appversion_get_get(self, appversion_id, is_check=''):
|
||||
return self._joyhub_request('GET', f'/admin-api/jh/appversion/get?id={appversion_id}', is_check, '获得app版本号管理')
|
||||
|
||||
def kw_in_joyhub_appversion_get_import_template_get(self, is_check=''):
|
||||
return self._joyhub_request('GET', '/admin-api/jh/appversion/get-import-template', is_check, '获得导入app版本号管理模板', return_json=False)
|
||||
|
||||
def kw_in_joyhub_appversion_import_excel_post(self, is_check='', **kwargs):
|
||||
return self._joyhub_request('POST', '/admin-api/jh/appversion/import-excel', is_check, '导入app版本号管理Excel', **kwargs)
|
||||
|
||||
def kw_in_joyhub_appversion_page_get(self, is_check='', **kwargs):
|
||||
return self._joyhub_request('GET', '/admin-api/jh/appversion/page', is_check, '获得app版本号管理分页', **kwargs)
|
||||
|
||||
def kw_in_joyhub_appversion_update_put(self, is_check='', **kwargs):
|
||||
return self._joyhub_request('PUT', '/admin-api/jh/appversion/update', is_check, '更新app版本号管理', **kwargs)
|
||||
|
||||
def kw_in_joyhub_user_create_post(self, is_check='', **kwargs):
|
||||
return self._joyhub_request('POST', '/admin-api/system/user/create', is_check, '创建用户', **kwargs)
|
||||
|
||||
@@ -330,6 +363,29 @@ class DlzhanInterface:
|
||||
def kw_in_joyhub_dept_update_put(self, is_check='', **kwargs):
|
||||
return self._joyhub_request('PUT', '/admin-api/system/dept/update', is_check, '更新部门', **kwargs)
|
||||
|
||||
# ============ 协议管理接口 ============
|
||||
def kw_in_joyhub_agreement_create_post(self, is_check='', **kwargs):
|
||||
return self._joyhub_request('POST', '/admin-api/jh/agreement/create', is_check, '创建协议', **kwargs)
|
||||
|
||||
def kw_in_joyhub_agreement_delete_delete(self, agreement_id, is_check=''):
|
||||
return self._joyhub_request('DELETE', f'/admin-api/jh/agreement/delete?id={agreement_id}', is_check, '删除协议')
|
||||
|
||||
def kw_in_joyhub_agreement_delete_list_delete(self, ids, is_check=''):
|
||||
ids_str = ','.join(map(str, ids))
|
||||
return self._joyhub_request('DELETE', f'/admin-api/jh/agreement/delete-list?ids={ids_str}', is_check, '批量删除协议')
|
||||
|
||||
def kw_in_joyhub_agreement_export_excel_get(self, is_check='', **kwargs):
|
||||
return self._joyhub_request('GET', '/admin-api/jh/agreement/export-excel', is_check, '导出协议 Excel', return_json=False, **kwargs)
|
||||
|
||||
def kw_in_joyhub_agreement_get_get(self, agreement_id, is_check=''):
|
||||
return self._joyhub_request('GET', f'/admin-api/jh/agreement/get?id={agreement_id}', is_check, '获得协议')
|
||||
|
||||
def kw_in_joyhub_agreement_page_get(self, is_check='', **kwargs):
|
||||
return self._joyhub_request('GET', '/admin-api/jh/agreement/page', is_check, '获得协议分页', **kwargs)
|
||||
|
||||
def kw_in_joyhub_agreement_update_put(self, is_check='', **kwargs):
|
||||
return self._joyhub_request('PUT', '/admin-api/jh/agreement/update', is_check, '更新协议', **kwargs)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
test = DlzhanInterface()
|
||||
|
||||
Reference in New Issue
Block a user