Commit 8648a99a2ba32c19f7fab088541d5874e00aa2f1

Authored by lixi
1 parent c9571dbf

更新文件

testcase/hg/loan_generalCustomer/test_generalCustomerLoan.py 0 → 100644
  1 +#!/usr/bin/python
  2 +# -*- coding: UTF-8 -*-
  3 +import unittest
  4 +from commons import common as com
  5 +from commons import ConfigDB as db
  6 +from commons.MySession import my,hg
  7 +from commons.api.hg.loan_generalCustomer.generalCustomerLoan_save import generalCustomerLoan_save
  8 +from commons.api.hg.loan_generalCustomer.generalCustomerLoan_delete import generalCustomerLoan_delete
  9 +from commons.api.hg.loan_generalCustomer.generalCustomerLoan_list import generalCustomerLoan_list
  10 +from commons.basic.registerRecord_save import registerRecord_save
  11 +from commons.basic.createAndTrade import createAndTrade
  12 +g=generalCustomerLoan_save()
  13 +l=generalCustomerLoan_list()
  14 +d=generalCustomerLoan_delete()
  15 +r=registerRecord_save()
  16 +c=createAndTrade()
  17 +
  18 +
  19 +class test_generalCustomerLoan(unittest.TestCase):
  20 + "杭果市场-借款管理-大客户借款"
  21 +
  22 + @classmethod
  23 + def setUpClass(cls) :
  24 + #新增一个进门批号单
  25 + re=hg.post(url=r.url,headers=r.header,json=r.body1)
  26 + #获取批号
  27 + cls.batch=re.json()["data"]["batchCode"]
  28 + #普通客户使用进门批号生成交易单
  29 + body=c.body1.copy()
  30 + body["orderItemList"][0]["batchCode"]=cls.batch
  31 + re1=hg.post(url=c.url,headers=c.header,json=body)
  32 +
  33 +
  34 + @unittest.case_mark(my.mark())
  35 + def test_generalCustomerLoan_01_save(self):
  36 + "普通借款-新增预支款:根据批次号新增预支款"
  37 + #替换批次号
  38 + body=g.body.copy()
  39 + body["batch"]=self.batch
  40 + #请求
  41 + re=hg.post(url=g.url,headers=g.header,json=body)
  42 + print(re.json(),"普通预付款批次号",self.batch)
  43 + self.assertEqual(re.status_code, 200)
  44 + self.assertTrue("操作成功" in str(re.json()).replace(" ",""))
  45 +
  46 +
  47 + @unittest.skipDepend(depend="test_generalCustomerLoan_01_save")
  48 + @unittest.case_mark(my.mark())
  49 + def test_generalCustomerLoan_02_list(self):
  50 + "普通借款-列表查询:执行状态,客户,批号和结算日期都输入合法值,查询指定借款数据"
  51 + #修改查询的值
  52 + body=l.body.copy()
  53 + body["batch"] = self.batch
  54 + body["settleDateStart"]=com.dates()
  55 + body["settleDateEnd"] = com.dates()
  56 + #请求
  57 + re=hg.post(url=l.url,headers=l.header,json=body)
  58 + print(re.json())
  59 + #断言
  60 + self.assertEqual(re.status_code, 200)
  61 + self.assertTrue("操作成功" in str(re.json()).replace(" ",""))
  62 + self.assertTrue(self.batch in str(re.json()).replace(" ",""))
  63 +
  64 +
  65 + @unittest.skipDepend(depend="test_generalCustomerLoan_01_save")
  66 + @unittest.case_mark(my.mark())
  67 + def test_generalCustomerLoan_03_delete(self):
  68 + "普通借款-撤销:撤销一个未执行的借款单"
  69 + #查询批次号对应id
  70 + batch_id=db.mysql_selectOne(d.sql.replace("2109000088",self.batch))[0]
  71 + #替换url的批次id
  72 + url=d.url.replace("66",str(batch_id))
  73 + #请求
  74 + re=hg.get(url=url,headers=d.header)
  75 + print(re.json(),"普通预付款批次号id",batch_id)
  76 + #断言
  77 + self.assertEqual(re.status_code, 200)
  78 + self.assertTrue("操作成功" in str(re.json()).replace(" ",""))
  79 +
  80 +
  81 +
  82 +
  83 +
  84 +if __name__ == "__main__":
  85 +
  86 + # unittest.main(verbosity=2)
  87 + com.run_one(test_generalCustomerLoan("test_generalCustomerLoan_01_save"))
... ...