class TestAllocateOrder: data = [('调拨理由为空', {'reasonCode': None}, '请选择调拨理由'), ('来源仓库空', {'sourceWarehouseId': None}, '请选择来源仓库'), ('来源仓库错误', {'targetWarehouseId': 'aa'}, '请求参数异常'), ('收货仓库为空', {'targetWarehouseId': None}, '请选择目标仓库'), # ('收货仓库错误', {'targetWarehouseId': 9999999}, '请求参数异常'), # ('商品ID为空', {'goodsId': None}, ''), ('商品数量为空', {'goodsQuantity': None}, '请输入商品数量'), ('商品数量过大', {'goodsQuantity': 999999999999}, '商品数量超出限制'), ('商品信息为空', {'goodsLotInfoId': None}, '参数异常'), ('工具包数量过大', {'kitStockQuantity': 99999999999999}, '工具包数量超出限制') ] @pytest.mark.parametrize('title,case,expected', data) @allure.title('{title}') def test_create(self, title, case, expected, AllocateOrder_get_Id): url = '/allocateOrder/create' body = timeid(file_yaml='request_data.yaml')._get_yaml_element_info()[url] body = request.reValue(body, case) response = request.post_body(url, body) assert response['msg'] == expected
def res_data(): timeid(file_yaml='request_data.yaml')._set_yaml_time({'url': 'body'}, 'w')
# __author:"zonglr" # date:2020/6/10 # !/usr/bin/env python3 # _*_ coding: utf-8 _*_ import requests, json from test_config import param_config, yamlconfig from common import login, logger headers = login.headers headers1 = login.headers1 api_url = param_config.api_url log = logger.Log() request_data = yamlconfig.timeid(file_yaml='request_data.yaml') # 替换参数 def reValue(body, data): for i in body.keys(): if type(body[i]) is str: pass elif type(body[i]) is dict: reValue(body[i], data) elif type(body[i]) is list: for j in body[i]: if type(j) is dict: reValue(j, data) if i in data.keys(): body[i] = data[i] return body
goodsQuantityList=goodsQuantityList) data = [ ('商品数量错误', { 'goodsDetails': [{ "goodsId": 11, "goodsLotInfoId": 88, "goodsQuantity": 2 }] }, '数量不一致,请确定数量'), ('仓库为空', { 'warehouseId': None }, '请选择仓库'), ('仓库错误', { 'warehouseId': 999999 }, '当前用户不能在该仓库创建加工单'), ] @allure.story('创建加工组包') @pytest.mark.parametrize('title,case,expected', data) def test_create_tools(self, title, case, expected, get_create_tools): url = '/packagingOrder/create' body = timeid( file_yaml='request_data.yaml')._get_yaml_element_info()[url] body = request.reValue(body, case) response = request.post_body01(url, body) if title == '商品数量错误': assert expected in response['msg'] else: assert response['msg'] == expected
class TestAdhocOrder: data = [ ('物资id为空', { 'goodsId': None }, '请输入商品id'), ('物资ID错误', { 'goodsId': 1111111 }, '商品不存在,请刷新重试'), ('套包ID为空', { 'kitTemplateId': None }, '请输入套包id'), ('套包ID错误', { 'kitTemplateId': 1111111 }, '工具包不存在,请刷新重试'), ('物资、套包为空', { 'goodsDetailUiBeans': [], 'toolsDetailUiBeans': [] }, '请选择物资'), ('医院为空', { 'hospitalName': None }, '请输入医院名称'), ('医院名字超长', { 'hospitalName': context }, '医院名称长度超出限制'), ('手术部位为空', { 'procedureSite': None }, '请选择手术部位'), ('手术部位错误', { 'procedureSite': [9999999] }, '请选择正确的手术部位'), ('主刀医生为空', { 'surgeon': None }, '请输入正确的主刀医生姓名'), ('主刀医生超长', { 'surgeon': longName }, '主刀医生名称长度超出限制'), ('订单联系人为空', { 'contactName': None }, '请输入正确的联系人姓名'), ('联系人电话为空', { 'contactPhone': None }, '请输入正确的手机号码'), ('品牌为空', { 'manufacturerId': None }, '品牌不能为空'), ('收货方式为空', { 'deliveryMode': None }, '请选择收货方式'), ('性别为空', { 'gender': None }, '请选择患者性别'), ('年龄段为空', { 'ageGroup': None }, '请选择患者年龄'), ('年龄段错误', { 'ageGroup': 'None' }, '请求参数异常'), # ('收件人为空', {'receivingName': None}, ''), ('默认地址为空', { 'addressId': None }, '请输入收货地址id'), ('默认地址错误', { 'addressId': 9999999 }, '所选地址不存在,请刷新重试'), # ('经销商为空', {'supplierId': None}, ''), ('手术时间为空', { 'procedureTime': None }, '请选择手术日期'), ('归还时间为空', { 'expectReturnTime': None }, '请选择归还日期'), ('手术日期小于当天', { 'procedureTime': yesterday_stamp }, '手术日期不能早于当天'), ('归还时间小于手术开始时间', { 'expectReturnTime': yesterday_stamp }, '预计归还日期不能早于手术日期'), ] @pytest.mark.parametrize('title,case,expected', data) @allure.title('{title}') def test_create(self, title, case, expected, AdhocOrder_get_id): url = '/adhocOrder/create' body = timeid( file_yaml='request_data.yaml')._get_yaml_element_info()[url] body = request.reValue(body, case) response = request.post_body(url, body) assert response['msg'] == expected
def test_edit(self, AllocateOrder_get_Id): url = '/allocateOrder/create' body = timeid(file_yaml='request_data.yaml')._get_yaml_element_info()[url] body = request.reValue(body, {'id': AllocateOrder_get_Id}) response = request.post_body(url, body) assert response['msg'] == '只能修改驳回的订单'