addproject
This commit is contained in:
75
zhyy/test_case/TestCase/接口/SZPurchase/PurchaseOrderManage.py
Normal file
75
zhyy/test_case/TestCase/接口/SZPurchase/PurchaseOrderManage.py
Normal file
@@ -0,0 +1,75 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
import allure
|
||||
import logging
|
||||
|
||||
from zhyy.library.BusinessKw.SZPurchase.PurchaseOrderManage import PurchaseOrder
|
||||
|
||||
|
||||
@allure.feature('深圳采购工作台采购订单页面')
|
||||
class Test_purchase_order(object):
|
||||
test_case = PurchaseOrder()
|
||||
|
||||
def teardown_method(self):
|
||||
logging.info("-----------------------------End-------------------------------")
|
||||
|
||||
@allure.story("验证采购工作台采购订单页面列表查询")
|
||||
def test_check_purchase_order_page(self):
|
||||
purchase_order_code = 'PO251209048' # 采购单号 必填
|
||||
supplier_company_ids = ['334'] # 供应商id 非必填
|
||||
payment_status = '0' # 付款状态 非必填
|
||||
status = '0' # 采购单状态 非必填
|
||||
page_no = 1 # 页码 必填
|
||||
page_size = 10 # 每页条数 必填
|
||||
response_data = self.test_case.kw_zhyy_get_purchase_page_post(
|
||||
note="采购工作台采购订单页面列表查询",
|
||||
user='purchase',
|
||||
order_sn=purchase_order_code,
|
||||
supplier_company_ids=supplier_company_ids,
|
||||
payment_status=payment_status,
|
||||
status=status,
|
||||
page_no=page_no,
|
||||
page_size=page_size
|
||||
)
|
||||
|
||||
# 断言检查
|
||||
assert response_data is not None, "响应数据不能为空"
|
||||
assert 'code' in response_data, "响应数据中缺少code字段"
|
||||
assert response_data['code'] == 0, "接口调用失败,code: {}, msg: {}".format(
|
||||
response_data.get('code'), response_data.get('msg', '未知错误'))
|
||||
assert 'data' in response_data, "响应数据中缺少data字段"
|
||||
assert response_data['data'] is not None, "响应数据中的data字段不能为空"
|
||||
|
||||
# 如果传入了采购单号,检查返回的数据中是否包含该采购单号
|
||||
if purchase_order_code:
|
||||
data = response_data.get('data', {})
|
||||
order_found = False
|
||||
|
||||
# 检查返回的数据结构,可能包含列表或其他结构
|
||||
if isinstance(data, dict):
|
||||
# 如果data是字典,可能包含records、list、data等字段
|
||||
records = data.get('records') or data.get('list') or data.get('data') or []
|
||||
if isinstance(records, list) and len(records) > 0:
|
||||
# 检查列表中是否包含指定的采购单号
|
||||
for item in records:
|
||||
if isinstance(item, dict):
|
||||
order_sn = item.get('order_sn') or item.get('orderSn') or item.get('orderSn')
|
||||
if order_sn == purchase_order_code:
|
||||
order_found = True
|
||||
break
|
||||
elif isinstance(data, list):
|
||||
# 如果data本身就是列表
|
||||
for item in data:
|
||||
if isinstance(item, dict):
|
||||
order_sn = item.get('order_sn') or item.get('orderSn') or item.get('orderSn')
|
||||
if order_sn == purchase_order_code:
|
||||
order_found = True
|
||||
break
|
||||
|
||||
if order_found:
|
||||
logging.info("✓ 断言通过:返回的数据中包含采购单号 {}".format(purchase_order_code))
|
||||
else:
|
||||
logging.warning("⚠ 警告:返回的数据中未找到采购单号: {},但接口调用成功".format(purchase_order_code))
|
||||
|
||||
logging.info("✓ 所有断言检查通过")
|
||||
print("✓ 查询成功,响应数据: {}".format(response_data))
|
||||
0
zhyy/test_case/TestCase/接口/SZPurchase/__init__.py
Normal file
0
zhyy/test_case/TestCase/接口/SZPurchase/__init__.py
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
19
zhyy/test_case/TestCase/接口/SZPurchase/index.py
Normal file
19
zhyy/test_case/TestCase/接口/SZPurchase/index.py
Normal file
@@ -0,0 +1,19 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
import allure
|
||||
import logging
|
||||
|
||||
from zhyy.library.BusinessKw.SZPurchase.index import PurchaseIndex
|
||||
|
||||
|
||||
@allure.feature('深圳采购工作台首页')
|
||||
class Test_purchase_index(object):
|
||||
# config = ReadConfig.ReadConfig() # 调用读取配置文件的方法类
|
||||
test_case = PurchaseIndex()
|
||||
|
||||
def teardown_method(self):
|
||||
logging.info("-----------------------------End-------------------------------")
|
||||
|
||||
@allure.story("验证采购工作台待办任务与在办任务功能")
|
||||
def test_check_todo(self):
|
||||
get_purchase_data = self.test_case.kw_zhyy_get_todo(note="采购工作台首页待办任务PO与在办任务PO", user='purchase')
|
||||
0
zhyy/test_case/TestCase/接口/__init__.py
Normal file
0
zhyy/test_case/TestCase/接口/__init__.py
Normal file
BIN
zhyy/test_case/TestCase/接口/__pycache__/__init__.cpython-38.pyc
Normal file
BIN
zhyy/test_case/TestCase/接口/__pycache__/__init__.cpython-38.pyc
Normal file
Binary file not shown.
Binary file not shown.
14
zhyy/test_case/TestCase/接口/conftest.py
Normal file
14
zhyy/test_case/TestCase/接口/conftest.py
Normal file
@@ -0,0 +1,14 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
"""
|
||||
测试配置文件
|
||||
用于设置测试环境的路径和配置
|
||||
"""
|
||||
import os
|
||||
import sys
|
||||
|
||||
# 添加项目根目录到 Python 路径,确保能导入 zhyy 模块
|
||||
current_file_path = os.path.abspath(__file__)
|
||||
# 从 test_case/TestCase/接口/conftest.py 向上找到项目根目录 d:\zhyy
|
||||
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)
|
||||
Reference in New Issue
Block a user