Commit dcf78fa23bc4c2c46a653dd70bce3dab60f66d31

Authored by liujiqiang
1 parent 28f2a535

结算管理-批号管理测试用例新增

commons/api/hg/CheckIn/CheckIn.py
... ... @@ -154,6 +154,6 @@ def create_registerRecord(session=None,host=None,ic="888800010591",goodsName="è‘
154 154 return resSave
155 155  
156 156  
157   -res = create_registerRecord(session=sessionHg,ic="888800010592",host=host,goodsName="苹果",allLevelKeyword="金牛区",
158   - nameLike="西区",tradePassword="111111",weight="50")
159   -print(res.text)
160 157 \ No newline at end of file
  158 +# res = create_registerRecord(session=sessionHg,ic="888800010592",host=host,goodsName="苹果",allLevelKeyword="金牛区",
  159 +# nameLike="西区",tradePassword="111111",weight="50")
  160 +# print(res.text)
161 161 \ No newline at end of file
... ...
report/test.log
1   -[2021-09-09 15:07:28] [INFO] : ======================================================================================
2   -[2021-09-09 15:07:28] [INFO] : http://test.uap.diligrp.com/api/authenticationApi/loginWeb
3   -[2021-09-09 15:07:28] [INFO] : http://10.28.12.150:80/api/authenticationApi/loginWeb
4   -{'data': None, 'json': {'userName': '111222', 'password': 'BWgL3Yc1wRb8kJicevOQcaMeCcxB7tFmjcWGQcD8wcX+B06hhtyuk5QMe/N3kKsZGyuKQ1InTE95jy9ZBVnzGxoLcwoVxZzlEsI8anoFst66N7giAyyU2IomupuB2siRt7bDu6o04+Snj/HTpztEecCLRvaVCh6yndLZC/8rNeU='}, 'headers': {'Content-Type': 'text/plain;charset=utf-8', 'Host': 'test.uap.diligrp.com', 'Content-Length': '209', 'Expect': '100-continue'}}
5   -
6   -[2021-09-09 15:07:28] [INFO] : ======================================================================================
7   -[2021-09-09 15:07:28] [INFO] : http://test.uap.diligrp.com/login/login.action
8   -[2021-09-09 15:07:28] [INFO] : http://10.28.12.150:80/login/login.action
  1 +[2021-09-10 10:56:27] [INFO] : ======================================================================================
  2 +[2021-09-10 10:56:27] [INFO] : http://test.uap.diligrp.com/api/authenticationApi/loginWeb
  3 +[2021-09-10 10:56:27] [INFO] : http://10.28.12.150:80/api/authenticationApi/loginWeb
  4 +{'data': None, 'json': {'userName': '111222', 'password': 'nr5/VixilW97NAW/OSKzjYCOmiALEs0DO5zOF4U4cofwjUUJxwgnZZUHeo0txa0Zp57PhbMVJD463Bn4nI0tBtKqqmjTi2c0EAQVWclAVP7XpQyY6qNT3vTRgAlwph34jYDSkxGeZQu5trWNiFVD0L9NI73rz39Tw9eBNonLH0U='}, 'headers': {'Content-Type': 'text/plain;charset=utf-8', 'Host': 'test.uap.diligrp.com', 'Content-Length': '209', 'Expect': '100-continue'}}
  5 +
  6 +[2021-09-10 10:56:27] [INFO] : ======================================================================================
  7 +[2021-09-10 10:56:27] [INFO] : http://test.uap.diligrp.com/login/login.action
  8 +[2021-09-10 10:56:27] [INFO] : http://10.28.12.150:80/login/login.action
9 9 {'data': b'userName=111222&password=111111', 'json': None, 'headers': {'Host': 'test.uap.diligrp.com', 'Connection': 'keep-alive', 'Content-Length': '33', 'Cache-Control': 'max-age=0', 'Upgrade-Insecure-Requests': '1', 'Origin': 'http://test.uap.diligrp.com', 'Content-Type': 'application/x-www-form-urlencoded', 'User-Agent': 'Mozilla/5.0(WindowsNT10.0;Win64;x64)AppleWebKit/537.36(KHTML,likeGecko)Chrome/90.0.4430.212Safari/537.36', 'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9', 'Referer': 'http://test.uap.diligrp.com/login/index.html', 'Accept-Encoding': 'gzip,deflate', 'Accept-Language': 'zh-CN,zh-TW;q=0.9,zh;q=0.8,en;q=0.7', 'Cookie': 'UAP_accessToken=;UAP_refreshToken=;UAP_loginPath='}, 'allow_redirects': False}
10 10  
11   -[2021-09-09 15:07:28] [INFO] : ======================================================================================
12   -[2021-09-09 15:07:28] [INFO] : http://test.card.diligrp.com:8386/contract/save.action
13   -{"notes": "123\u5907\u6ce8", "customerId": 141963, "consignorCustomerName": "\u676d\u679c\u5ba2\u6237\u957f\u6b4c\u4e00", "cardNo": "888800010592", "consignorCustomerIDCode": "110101202108265741", "consignorCustomerMobile": "18080018009", "consignorCustomerCode": "00131684", "consignorAccountId": 107667, "startTime": "2021-09-09", "endTime": "2021-09-13", "consignors": [{"consigneeName": "\u5f20\u4e09", "consigneeIdCode": "513922198704216819", "consigneeIdMobile": "asda", "signatureImagePath": "5f68851207864520924e41b7f73c208c"}], "consigneeNames": "\u5510\u5ddd", "node": "signatureImagePathConsignor", "signatureImagePath": "bbdcbcca70a74adfb10b7fb86de5d04c"}
  11 +[2021-09-10 10:56:28] [INFO] : ======================================================================================
  12 +[2021-09-10 10:56:28] [INFO] : http://test.gateway.diligrp.com:8285/hg-trading/api/businessChargeItem/listBusinessChargeItem
  13 +{"marketId": 15, "businessType": "501"}
14 14 {}
15 15  
  16 +[2021-09-10 10:56:28] [INFO] : ======================================================================================
  17 +[2021-09-10 10:56:28] [INFO] : http://test.gateway.diligrp.com:8285/card-web/accountQuery/simpleInfo.action
  18 +None
  19 +{'params': {'cardNo': '888800010591'}}
  20 +
  21 +[2021-09-10 10:56:28] [INFO] : ======================================================================================
  22 +[2021-09-10 10:56:28] [INFO] : http://test.gateway.diligrp.com:8285/assets-service/api/cusCategory/getTree
  23 +{"marketId": 15, "keyword": "\u8461\u8404", "state": 1}
  24 +{}
  25 +
  26 +[2021-09-10 10:56:28] [INFO] : ======================================================================================
  27 +[2021-09-10 10:56:28] [INFO] : http://test.gateway.diligrp.com:8285/assets-service/api/city/listByKeywordsWithCityCode
  28 +{"allLevelKeyword": "\u4e07\u5dde"}
  29 +{}
  30 +
  31 +[2021-09-10 10:56:28] [INFO] : ======================================================================================
  32 +[2021-09-10 10:56:28] [INFO] : http://test.gateway.diligrp.com:8285/assets-service/api/district/search
  33 +{"marketId": 15, "nameLike": "\u897f\u533a"}
  34 +{}
  35 +
  36 +[2021-09-10 10:56:28] [INFO] : ======================================================================================
  37 +[2021-09-10 10:56:28] [INFO] : http://test.gateway.diligrp.com:8285/dili-rule/api/chargeRule/queryFee
  38 +{"businessType": "501", "chargeItem": 518, "marketId": 15}
  39 +{}
  40 +
  41 +[2021-09-10 10:56:28] [INFO] : ======================================================================================
  42 +[2021-09-10 10:56:28] [INFO] : http://test.gateway.diligrp.com:8285/dili-rule/api/chargeRule/queryFee
  43 +{"businessType": "501", "chargeItem": 520, "marketId": 15}
  44 +{}
  45 +
  46 +[2021-09-10 10:56:28] [INFO] : ======================================================================================
  47 +[2021-09-10 10:56:28] [INFO] : http://test.gateway.diligrp.com:8285/hg-trading/api/registerRecord/save
  48 +{"accountId": 107796, "cardNo": "888800010591", "customerId": 142000, "customerCode": "00131702", "customerName": "\u53f2\u4e1c\u6676", "fixedphoneNumber": null, "mobilephoneNumber": "18080008020", "identityCardAddress": "", "identityCardNo": "110101202109024587", "identityCardType": "ID", "registerDetailDtoList": [{"id": 0, "areaId": 272, "areaName": "\u897f\u533a", "quantity": 0, "productId": 754107, "registerRecordId": 0, "remark": null, "weight": 100, "weightType": 0, "created": null, "createdById": 0, "createdByName": null, "createdByDepartmentId": 0, "createdByDepartmentName": null, "registerCertificateList": null, "product": null, "registerCertificateDtoList": null, "productDto": {"id": 0, "originId": 500101, "originName": "\u4e07\u5dde\u533a", "pieceWeight": 0, "categoryId": 754107, "categoryCode": 754107, "categoryName": "\u8461\u8404", "created": null}}], "registerFeeDtoList": [{"id": 0, "actualFee": 200, "receivableFee": 1300, "discountFee": 1100, "registerRecordId": 0, "payStatus": 0, "chargeItemName": "\u5176\u4ed6\u6536\u8d39", "chargeType": 1, "chargeItemId": 518, "registerFeeType": 999, "created": null, "createdById": 0, "createdByName": null, "settleDate": null, "isBehalf": 0, "registerLoadingFeeExtDto": null}], "tradePassword": "111111"}
  49 +{}
  50 +
  51 +[2021-09-10 10:56:28] [INFO] : ======================================================================================
  52 +[2021-09-10 10:56:28] [INFO] : http://test.gateway.diligrp.com:8285/hg-trading/api/settle/changeBatchCodeState
  53 +{"batchCode": "2109000240", "state": 2}
  54 +{}
  55 +
  56 +[2021-09-10 10:56:29] [INFO] : ======================================================================================
  57 +[2021-09-10 10:56:29] [INFO] : http://test.gateway.diligrp.com:8285/hg-trading/api/settle/batchCodeQuery
  58 +None
  59 +{'params': {'batchCode': '2109000240', '_t': '1631094801343'}}
  60 +
... ...
testcase/hg/test_batch/test_batch.py 0 → 100644
  1 +# -*- coding: utf-8 -*-
  2 +
  3 +# @Time : 2021/9/10 10:17
  4 +# @Author : Ljq
  5 +# @File : test_batch.py
  6 +# @Software: PyCharm
  7 +
  8 +"""
  9 +杭果市场-结算管理-批号管理
  10 +"""
  11 +
  12 +from commons.MySession import sessionHg as session
  13 +from commons.api.hg.CheckIn import CheckIn
  14 +from commons.api.hg.settlement import batch
  15 +from commons.scripts.readConf import rC
  16 +import unittest,random
  17 +
  18 +class test_batch(unittest.TestCase):
  19 + """杭果市场-结算管理-批号管理"""
  20 + def setUp(self) -> None:
  21 + pass
  22 +
  23 + def tearDown(self) -> None:
  24 + pass
  25 +
  26 + @classmethod
  27 + def setUpClass(cls) -> None:
  28 + cls.gatewayHost = rC.returnOptionsItems("host", "gatewayHost")
  29 + cls.jmsfHost = rC.returnOptionsItems("host", "jmsfHost")
  30 + cls.ic = rC.returnOptionsItems("testInfo", "hg_cardNumRe_01")
  31 +
  32 + @classmethod
  33 + def tearDownClass(cls) -> None:
  34 + pass
  35 +
  36 + def test_searchState_1(self):
  37 + """
  38 + 批号管理--查询--输入【在售】状态的完整批号,查询出该批号下的相关数据
  39 + """
  40 + # 创建初始数据
  41 + resBatchCode = CheckIn.create_registerRecord(session=session, host=self.gatewayHost,ic=self.ic)
  42 + self.batchCode = resBatchCode.json()["data"]["batchCode"]
  43 + # 执行查询
  44 + print("test_searchState_1 --> self.batchCode:",self.batchCode)
  45 + resSearchState = batch.batchCodeQuery(session=session,host=self.gatewayHost,batchCode=self.batchCode)
  46 + print(resSearchState.json())
  47 + assert resSearchState.json()["code"] == "200","在售状态的登记单查询失败"
  48 + assert resSearchState.json()["state"] == 1,"在售状态的登记单查询失败"
  49 + assert resSearchState.json()["data"]["state"] == 1, "在售状态的登记单查询失败"
  50 + assert resSearchState.json()["data"]["batchCode"] == self.batchCode, "在售状态的登记单查询失败"
  51 +
  52 + def test_searchState_2(self):
  53 + """
  54 + 批号管理--查询--输入【关闭】状态的完整批号,查询出该批号下的相关数据
  55 + """
  56 + # 创建初始数据
  57 + resBatchCode = CheckIn.create_registerRecord(session=session, host=self.gatewayHost,ic=self.ic)
  58 + self.batchCode = resBatchCode.json()["data"]["batchCode"]
  59 + print("test_searchState_1 --> self.batchCode:", self.batchCode)
  60 + # 将批号关闭
  61 + resChange = batch.changeBatchCodeState(session=session,host=self.gatewayHost,batchCode=self.batchCode)
  62 + assert resChange.json()["message"] == "success","批号关闭成功"
  63 + # 执行查询
  64 + resSearchState = batch.batchCodeQuery(session=session,host=self.gatewayHost,batchCode=self.batchCode)
  65 + print(resSearchState.json())
  66 + assert resSearchState.json()["code"] == "200","在售状态的登记单查询失败"
  67 + assert resSearchState.json()["state"] == 2,"在售状态的登记单查询失败"
  68 + assert resSearchState.json()["data"]["state"] == 2, "在售状态的登记单查询失败"
  69 + assert resSearchState.json()["data"]["batchCode"] == self.batchCode, "在售状态的登记单查询失败"
  70 +
  71 + def test_batchDetails(self):
  72 + """
  73 + 批号管理--列表--【列表】中数据显示正确
  74 + """
  75 + # 创建初始数据
  76 + goodsName="西瓜"
  77 + weight = random.randint(50,100)
  78 + print("weight",weight)
  79 + resBatchCode = CheckIn.create_registerRecord(session=session, host=self.gatewayHost,ic=self.ic,goodsName=goodsName,
  80 + weight=weight)
  81 + self.batchCode = resBatchCode.json()["data"]["batchCode"]
  82 + print("test_searchState_1 --> self.batchCode:", self.batchCode)
  83 + # 执行查询
  84 + resSearchState = batch.batchCodeQuery(session=session,host=self.gatewayHost,batchCode=self.batchCode)
  85 + print(resSearchState.json())
  86 + assert resSearchState.json()["code"] == "200","查询状态码返回错误"
  87 + assert resSearchState.json()["data"]["batchCode"] == self.batchCode, "查询获得订单与实际订单不一致"
  88 + assert resSearchState.json()["data"]["registerDetail"][0]["categoryName"] == goodsName, "批号的商品信息与创建时不一致"
  89 + assert resSearchState.json()["data"]["registerDetail"][0]["weight"] == weight, "批号的重量信息与创建时不一致"
  90 +
  91 + def test_changeState_1(self):
  92 + """
  93 + 批号管理--恢复交款--“关闭”状态的批号,可【恢复交款】成功
  94 + """
  95 + # 创建初始数据
  96 + resBatchCode = CheckIn.create_registerRecord(session=session, host=self.gatewayHost,ic=self.ic)
  97 + self.batchCode = resBatchCode.json()["data"]["batchCode"]
  98 + print("test_searchState_1 --> self.batchCode:", self.batchCode)
  99 + # 将批号关闭
  100 + resChange = batch.changeBatchCodeState(session=session,host=self.gatewayHost,batchCode=self.batchCode,state=2)
  101 + assert resChange.json()["message"] == "success","批号关闭成功"
  102 + resChange = batch.changeBatchCodeState(session=session,host=self.gatewayHost,batchCode=self.batchCode,state=1)
  103 + assert resChange.json()["message"] == "success","批号关闭成功"
  104 + # 执行查询
  105 + resSearchState = batch.batchCodeQuery(session=session,host=self.gatewayHost,batchCode=self.batchCode)
  106 + print(resSearchState.json())
  107 + assert resSearchState.json()["data"]["state"] == 1, "在售状态的登记单查询失败"
  108 + assert resSearchState.json()["data"]["batchCode"] == self.batchCode, "在售状态的登记单查询失败"
  109 +
  110 + def test_changeState_2(self):
  111 + """
  112 + 批号管理--恢复交款--“在售”状态的批号,可【停止交款】成功
  113 + """
  114 + # 创建初始数据
  115 + resBatchCode = CheckIn.create_registerRecord(session=session, host=self.gatewayHost,ic=self.ic)
  116 + self.batchCode = resBatchCode.json()["data"]["batchCode"]
  117 + print("test_searchState_1 --> self.batchCode:", self.batchCode)
  118 + # 将批号关闭
  119 + resChange = batch.changeBatchCodeState(session=session,host=self.gatewayHost,batchCode=self.batchCode,state=2)
  120 + assert resChange.json()["message"] == "success","批号关闭成功"
  121 + # 执行查询
  122 + resSearchState = batch.batchCodeQuery(session=session,host=self.gatewayHost,batchCode=self.batchCode)
  123 + print(resSearchState.json())
  124 + assert resSearchState.json()["data"]["state"] == 2, "在售状态的登记单查询失败"
  125 + assert resSearchState.json()["data"]["batchCode"] == self.batchCode, "在售状态的登记单查询失败"
... ...