Files
smart-management-auto-test/zhyy/library/ZZYY_interface.py
qiaoxinjiu 6994b185a3 addproject
2026-01-22 19:10:37 +08:00

69 lines
2.8 KiB
Python
Raw Permalink 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-*
import os
import sys
# 添加项目根目录到 Python 路径,以便导入 base_framework 模块
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 base_framework.public_tools import utils
from base_framework.public_tools.log import get_logger
from base_framework.public_tools.runner import Runner
from base_framework.public_tools.utils import Tools
from base_framework.public_tools import check_resp, convert_json, get_user, custom_check_resp
from base_framework.public_tools.eureka_api import EurekaAPI
import requests
obj_runner = Runner()
obj_log = get_logger()
tools = Tools()
obj_tool = utils.Tools()
s = requests.session()
eureka = EurekaAPI()
class ZhyyInterface:
def __init__(self):
self.domain_url = eureka.get_url_from_config()
def kw_in_zhyy_purchase_todo_get(self, is_check='', **kwargs):
"""
查询采购待办任务 + POST + interface id: 88383
url: http://peppa-personas-server.qa.huohua.cn/crowd_pack_query/list
| 请求参数名 | 说明 | 类型 | 条件 | 是否必填 |
| is_check | is_check默认空不校验返回有值就校验返回 | string | 业务case的时候需要传入值 | False |
"""
user, kwargs = get_user(kwargs)
kwargs = convert_json(kwargs)
url = "%s/erp/purchase-workbench/get-todo" % self.domain_url
obj_log.info("your input:{0}".format(kwargs))
resp = obj_runner.call_rest_api(API_URL=url, req_type="GET", user=user)
check_resp(is_check, resp)
return resp
def kw_in_zhyy_purchase_order_page_post(self, is_check='', **kwargs):
"""
查询采购单列表 + POST + interface id: 88383
url: http://peppa-personas-server.qa.huohua.cn/admin-api/erp/purchase-order/page
| 请求参数名 | 说明 | 类型 | 条件 | 是否必填 |
| is_check | is_check默认空不校验返回有值就校验返回 | string | 业务case的时候需要传入值 | False |
| pageNum | 页码 | integer | None | 0 |
| pageSize | 每页条数 | integer | None | 0 |
"""
user, kwargs = get_user(kwargs)
kwargs = convert_json(kwargs)
url = "%s/erp/purchase-order/page" % self.domain_url
obj_log.info("your input:{0}".format(kwargs))
resp = obj_runner.call_rest_api(API_URL=url, req_type="POST", json=kwargs, user=user)
check_resp(is_check, resp)
return resp
if __name__ == '__main__':
test = ZhyyInterface()
# print(test.domain_url)
a = test.kw_in_zhyy_purchase_todo_get(
user="purchase")
print(a)