Exemplo n.º 1
0
 def test_00100_submitpurchaseorder(self):
     """采购单提交接口(正常)"""
     data1 = [{
         "goodsCostPrice": 30,
         "goodsSkuCode": "1560751503346043",
         "goodsSpuCode": "1560751502987925",
         "goodsTransactionPrice": 30,
         "transQty": 1
     }]
     data = {
         "accountId": "1102522438563991554",
         "accountName": "现金",
         "channel": "1",  # 19:IOS 20.Android 21:PC
         "orderDetailModel": [json.dumps(data1)],
         "orderSkuQty": "1",
         "orderSpuQty": "1",
         "orderTransactionMoney": 30.0,
         "remarks": "",
         "supplierName": "供应商1",
         "supplierId": "1559464679881381",
         "transTypeId": "T201"
     }
     url = self.base_url + '/order/purchaseOrder/submitPurchaseOrder'
     response = requests.post(headers=self.header, url=url, data=data)
     res = response.json()
     purchase_order_num = res['result']['orderCode']
     purchase_order_id = res['result']['id']
     ReadData().write_data('purchase_order', 'id', purchase_order_id)
     ReadData().write_data('purchase_order', 'ordernum', purchase_order_num)
Exemplo n.º 2
0
 def setUp(self):
     self.authorization = ReadData().get_api_info()['authorization']
     self.base_url = ReadData().get_api_info()['base_url']
     self.header = {
         'user-agent': 'Mozilla/5.0',
         'Content-Type': 'application/x-www-form-urlencoded',
         'authorization': self.authorization
     }
Exemplo n.º 3
0
 def __init__(self):
     self.header = {'user-agent': 'Mozilla/5.0', 'Content-Type': 'application/x-www-form-urlencoded'}
     self.base_url = ReadData().get_api_info()['base_url']
     self.loginname = ReadData().get_api_info()['loginname']
     self.code = ReadData().get_api_info()['code']
     self.authorization = ReadData().get_api_info()['authorization']
     self.data = {
         "loginname": self.loginname,
         "messageCode": self.code,
         "deviceType": 1
     }
     self.data1 = {
         'id': 1135580521435267073
     }
Exemplo n.º 4
0
 def test_00100_submitsaleorder(self):
     """销售单提交接口(正常)"""
     data1 = [{
         "goodsCostPrice": 30,
         "goodsDiscount": 10,
         "goodsDiscountMoney": 0,
         "goodsPreferentialType": 0,
         "goodsRetailPrice": 120,
         "goodsSkuCode": "1560751503346043",
         "goodsSpuCode": "1560751502987925",
         "goodsTransactionPrice": 120,
         "transQty": 1
     }]
     data2 = [{"salesmanId": "1102522113031491586", "salesmanName": "老板"}]
     data = {
         "accountId": "1102522438563991554",
         "accountName": "现金",
         "channel": "1",
         "orderDetailModel": [json.dumps(data1)],
         "salesmen": [json.dumps(data2)],
         "orderSkuQty": "1",
         "orderSpuQty": "1",
         "remarks": "",
         "supplierName": "供应商1",
         "orderEraseMoney": 0.0,
         "orderRetailMoney": 120.0,
         "orderDetailTransactionMoney": 120.0,
         "orderTransactionMoney": 120.0,
         "orderDiscountMoney": 0.0,
         "orderDiscount": 10.0,
         "orderPreferentialType": 0,
         "transTypeId": "T101"
     }
     url = self.base_url + '/order/saleOrder/submitSaleOrder'
     response = requests.post(headers=self.header, url=url, data=data)
     res = response.json()
     print(res)
     sale_order_num = res['result']['orderCode']
     sale_order_id = res['result']['id']
     ReadData().write_data('sales_order', 'id', sale_order_id)
     ReadData().write_data('sales_order', 'ordernum', sale_order_num)
     result = res['result']
     responsecode = int(res['responseCode'])
     success = res['success']
     self.assertEqual(responsecode, 200)
     self.assertEqual(success, True)
     self.assertNotEqual(result, None)
Exemplo n.º 5
0
 def login(self):
     url = self.base_url + '/user/login/loginApp'
     response = requests.post(headers=self.header, url=url, data=self.data)
     res = response.json()
     print(res)
     token = res.get('result')['token']
     final_token = str(token)
     ReadData().write_data('api', 'authorization', final_token)
     return final_token
Exemplo n.º 6
0
 def test_00101_submitpurchasereturnorder(self):
     """采购退货单提交接口(原单退货正常)"""
     self.test_00100_submitpurchaseorder()
     purchase_id = ReadData().get_data('purchase_order', 'id')
     data1 = [{
         "goodsCostPrice": 30,
         "goodsSkuCode": "1560751503346043",
         "goodsSpuCode": "1560751502987925",
         "goodsTransactionPrice": 30,
         "transQty": 1
     }]
     data = {
         "orderOriginId": purchase_id,
         "accountId": "1102522438563991554",
         "accountName": "现金",
         "channel": "1",
         "orderDetailModel": [json.dumps(data1)],
         "orderSkuQty": "1",
         "orderSpuQty": "1",
         "orderTransactionMoney": 30.0,
         "remarks": "",
         "supplierName": "供应商1",
         "supplierId": "1559464679881381",
         "transTypeId": "T203"
     }
     url = self.base_url + '/order/purchaseReturnOrder/submitPurchaseReturnOrder'
     response = requests.post(headers=self.header, url=url, data=data)
     res = response.json()
     print(res)
     responsecode = int(res['responseCode'])
     success = int(res['success'])
     result = res['result']
     purchase_return_order_num = res['result']['orderCode']
     purchase_return_order_id = res['result']['id']
     ReadData().write_data('purchase_return_order', 'id',
                           purchase_return_order_id)
     ReadData().write_data('purchase_return_order', 'ordernum',
                           purchase_return_order_num)
     self.assertEqual(responsecode, 200, '发送请求失败')
     self.assertEqual(success, True, '发送请求失败')
     self.assertNotEqual(result, None, '发送请求失败')
 def test_00601_cancelsaleorder(self):
     """销售单作废接口(正常)"""
     sale_id = ReadData().get_data('sales_order', 'id')
     data = {"id": sale_id}
     url = self.base_url + '/order/saleOrder/cancelSaleOrder'
     response = requests.post(headers=self.header, url=url, data=data)
     res = response.json()
     print(res)
     responsecode = int(res['responseCode'])
     success = res['success']
     self.assertEqual(responsecode, 200, '发送请求失败')
     self.assertEqual(success, True, '发送请求失败')
 def test_00401_batchcleancancelledsaleorder(self):
     """批量清空销售单挂单接口(正常)"""
     huang_up_id = ReadData().get_data('huang_up_order', 'id')
     data = {"ids": huang_up_id}
     url = self.base_url + '/order/saleOrder/batchCleanCancelledSaleOrder'
     response = requests.post(headers=self.header, url=url, data=data)
     res = response.json()
     print(res)
     responsecode = int(res['responseCode'])
     success = res['success']
     self.assertEqual(responsecode, 200, '发送请求失败')
     self.assertEqual(success, True, '发送请求失败')
 def test_00301_querycancelledsaleorderbyid(self):
     """销售挂单列表销售单详情查询(正常)"""
     huang_up_id = ReadData().get_data('huang_up_order', 'id')
     data = {"id": huang_up_id}
     url = self.base_url + '/order/saleOrder/queryCancelledSaleOrderById'
     response = requests.post(headers=self.header, url=url, data=data)
     res = response.json()
     print(res)
     responsecode = int(res['responseCode'])
     success = res['success']
     self.assertEqual(responsecode, 200, '发送请求失败')
     self.assertEqual(success, True, '发送请求失败')
Exemplo n.º 10
0
 def test_00201_cancelpurchaseorder(self):
     """作废采购退货单接口(正常)"""
     purchase_return_id = ReadData().get_data('purchase_return_order', 'id')
     data = {
         "id": purchase_return_id  # 采购订单id
     }
     url = self.base_url + '/order/purchaseReturnOrder/cancelPurchaseReturnOrder'
     response = requests.post(headers=self.header, url=url, data=data)
     res = response.json()
     print(res)
     responsecode = int(res['responseCode'])
     success = res['success']
     self.assertEqual(responsecode, 200, '发送请求失败')
     self.assertEqual(success, True, '发送请求失败')
 def test_00602_cancelsaleorder(self):
     """销售单作废接口(已作废订单重复作废)"""
     sale_id = ReadData().get_data('sales_order', 'id')
     data = {"id": sale_id}
     url = self.base_url + '/order/saleOrder/cancelSaleOrder'
     response = requests.post(headers=self.header, url=url, data=data)
     res = response.json()
     print(res)
     responsecode = int(res['responseCode'])
     success = res['success']
     responsemsg = res['responseMsg']
     self.assertEqual(responsecode, 1001, '发送请求失败')
     self.assertEqual(responsemsg, '当前订单已作废,不可重复作废', '发送请求失败')
     self.assertEqual(success, False, '发送请求失败')
Exemplo n.º 12
0
 def __init__(self):
     self.mail_host = ReadData().get_sendEmail_info()['mail_host']
     self.mail_port = ReadData().get_sendEmail_info()['mail_port']
     self.mail_account = ReadData().get_sendEmail_info()['mail_account']
     self.mail_pwd = ReadData().get_sendEmail_info()['mail_pwd']
     self.mail_sender = ReadData().get_sendEmail_info()['mail_sender']
     self.mail_receiver = ReadData().get_sendEmail_info()['mail_receiver']
     self.test_report = self.get_filepath()
     self.logger = Logger().get_log()
Exemplo n.º 13
0
 def test_00102_submitpurchasereturnorder(self):
     """销售退货单提交接口(直接退货正常)"""
     data1 = [{
         "goodsCostPrice": 30,
         "goodsSkuCode": "1560751503346043",
         "goodsSpuCode": "1560751502987925",
         "goodsTransactionPrice": 120,
         "transQty": 1
     }]
     data2 = [{"salesmanId": "1102522113031491586", "salesmanName": "老板"}]
     data = {
         "accountId": "1102522438563991554",
         "accountName": "现金",
         "channel": "1",
         "orderDetailModel": [json.dumps(data1)],
         "orderSkuQty": "1",
         "orderSpuQty": "1",
         "orderTransactionMoney": 120,
         "remarks": "",
         "transTypeId": "T102",
         "salesmen": [json.dumps(data2)]
     }
     url = self.base_url + '/order/saleReturnOrder/submitSaleReturnOrder'
     response = requests.post(headers=self.header, url=url, data=data)
     res = response.json()
     print(res)
     responsecode = int(res['responseCode'])
     success = int(res['success'])
     result = res['result']
     sale_order_num = res['result']['orderCode']
     sale_order_id = res['result']['id']
     ReadData().write_data('sales_return_order', 'id', sale_order_id)
     ReadData().write_data('sales_return_order', 'ordernum', sale_order_num)
     self.assertEqual(responsecode, 200, '发送请求失败')
     self.assertEqual(success, True, '发送请求失败')
     self.assertNotEqual(result, None, '发送请求失败')
Exemplo n.º 14
0
 def test_00301_querypurchasereturnInfo(self):
     """采购退货单详情查询接口(正常)"""
     purchase_id = ReadData().get_data('purchase_return_order', 'id')
     data = {
         "id": purchase_id  # 采购订单id
     }
     url = self.base_url + '/order/purchaseReturnOrder/queryPurchaseReturnInfoById'
     response = requests.post(headers=self.header, url=url, data=data)
     res = response.json()
     print(res)
     responsecode = int(res['responseCode'])
     success = res['success']
     result = res['result']
     self.assertEqual(responsecode, 200, '发送请求失败')
     self.assertNotEqual(result, None, '发送请求失败')
     self.assertEqual(success, True, '发送请求失败')
Exemplo n.º 15
0
 def test_00202_cancelpurchasereturnorder(self):
     """作废采购退货单接口(已作废订单id)"""
     purchase_return_id = ReadData().get_data('purchase_return_order', 'id')
     data = {
         "id": purchase_return_id  # 采购订单id
     }
     url = self.base_url + '/order/purchaseReturnOrder/cancelPurchaseReturnOrder'
     response = requests.post(headers=self.header, url=url, data=data)
     res = response.json()
     print(res)
     responsecode = int(res['responseCode'])
     responsemsg = res['responseMsg']
     success = res['success']
     self.assertEqual(responsecode, 1001, '发送请求失败')
     self.assertEqual(responsemsg, '采购退货单已作废!', '发送请求失败')
     self.assertEqual(success, False, '发送请求失败')
 def test_00501_querysaleorderinfobyid(self):
     """销售单详情查询接口(正常)"""
     sale_id = ReadData().get_data('sales_order', 'id')
     data = {
         "id": sale_id  # 销售单id
     }
     url = self.base_url + '/order/saleOrder/querySaleOrderInfoById'
     response = requests.post(headers=self.header, url=url, data=data)
     res = response.json()
     print(res)
     responsecode = int(res['responseCode'])
     success = res['success']
     result = res['result']
     self.assertEqual(responsecode, 200, '发送请求失败')
     self.assertEqual(success, True)
     self.assertNotEqual(result, None, '查询失败,返回结果错误')