示例#1
0
 def test_cpPurchaseRequestOverproof(self, gettokenfixture, auditFlag,
                                     expect):
     s = gettokenfixture
     self.log.info("----采购申请配额超标审核----")
     r = SRMBase(s)
     uid = r.srm_uuid()
     r.cpLackMaterialSub_Temp(uid, code="105000007", demand=401)  # 超标采购申请新增
     msg = r.cpLackMaterialSub_push(uid, caigouyuan="zhongzijian")
     result = msg[0]
     self.log.info("获取新增结果{}".format(result.json()))
     try:
         msg_getRequestid = r.cp_zdpage(key="materialCode",
                                        value="105000007")  # 查询目标采购申请
         Requestid = jsonpath.jsonpath(msg_getRequestid.json(),
                                       '$..purchaseRequestId')[0]
         Detailid = jsonpath.jsonpath(msg_getRequestid.json(),
                                      '$..requestDetailId')[0]
         self.log.info("获取采购申请ID:%s" % Requestid)
     except:
         self.log.error("获取采购申请数据错误")
     msg_allotDty = r.cp_zdallotDty(Requestid, Detailid)  # 分配采购申请
     Alloid = msg_allotDty.json()["data"][0]
     commit = r.cp_zdcomits(Requestid, Detailid, Alloid)  #分配页面提交
     sql = "UPDATE BUSINESS_WAIT_APPROVE_RECORD SET APPROVE_BY = 'zhongzijian' WHERE PROCESS_NAME = '采购申请超标审批流'"
     Db_Oracle().update(sql)
     page = r.cp_customPage("materialCode", "105000007")
     auditid = jsonpath.jsonpath(page.json(), '$..requestOverproofId')[0]
     purchaseRequestNo = jsonpath.jsonpath(page.json(),
                                           '$..purchaseRequestNo')[0]
     msg = r.cp_audit(auditid, auditFlag)
     self.log.info("审核结果是:%s" % msg.json())
     ass = r.cp_examineRecordsPg("purchaseRequestNo", purchaseRequestNo)
     status = jsonpath.jsonpath(ass.json(), '$..status')[0]
     assert status == expect
示例#2
0
 def test_cp_examineRecordsPg(self, gettokenfixture, key, value):
     s = gettokenfixture
     self.log.info("配额超标审核记录查询")
     r = SRMBase(s)
     msg = r.cp_examineRecordsPg(key, value)
     self.log.info("获取的结果是:%s" % msg.json())
     a_msg = jsonpath.jsonpath(msg.json(), '$..purchaseRequestNo')[0]
     b_msg = jsonpath.jsonpath(msg.json(), '$..materialCode')[0]
     if key == "purchaseRequestNo":
         assert a_msg == value
     else:
         assert b_msg == value