def setUp(self): self.base_url = "http://10.0.4.66:61020/api/order/apply/acceptance" self.case_name = " " self.a = SqlExecution() i = self.a.get_value( "SELECT t.`program_id` FROM `t_order_apply` t WHERE t.`audit_status`=0 AND t.`sys_flag`=0 AND t.`channel_id`IS NULL;" ) print(i) self.body_data = { "programId": i, "userId": 6, "operatorName": "小木鸟", "channelId": 4, "remark": "接口测试自动审核" } self.body_nodata = { "userId": 6, "operatorName": "小木鸟", "channelId": 4, "remark": "接口测试自动审核" } self.body_nouserId = { "programId": i, "operatorName": "小木鸟", "channelId": 4, "remark": "接口测试自动审核" }
def setUp(self): self.base_url = "http://10.0.4.66:61020/api/factoring/payment/apply/bill/creation" self.case_name = "" #获取当前待生成还款单的请用单号 self.a = SqlExecution () i = self.a.get_value ( "SELECT t.`business_order_id` FROM `t_loan_order` t WHERE t.`status`=3 AND t.`sys_flag`=0 AND t.`channel_id` != 4 AND t.`business_order_id` IS NOT NULL;") list = [] list.append (i) #参数 self.body_data = {"businessOrderIdList": list, "billType": 1, "userId": 6, "operatorName": "小木鸟" } self.body_nobusinessOrderIdList = {"billType": 1, "userId": 6, "operatorName": "小木鸟" } self.body_nobillType = {"businessOrderIdList": list, "userId": 6, "operatorName": "小木鸟" } self.body_nooperatorName = {"businessOrderIdList": list, "billType": 1, "userId": 6 } self.header = {"content-type": "application/json"}
class StoreAuditTest (unittest.TestCase): def setUp(self): self.base_url = "http://10.0.4.66:61020/api/factoring/store/operation/auditAcceptance" self.case_name = " " self.a = SqlExecution () i = self.a.get_value ( "SELECT t.`store_id` FROM `t_enterprise_verification_info` t WHERE t.`audit_status`=0 AND t.`sys_flag`=0 AND t.`status`=2") print(i) self.body_data = {"storeId": i, "userId": 6, "operatorName": "小木鸟", "auditRemark": "自动化测试审核通过" } self.body_nodata = { "userId": 6, "operatorName": "小木鸟", "auditRemark": "自动化测试审核通过" } self.body_nouserId = {"storeId": i, "operatorName": "小木鸟", "auditRemark": "自动化测试审核通过" } def test_store_audit(self): '''门店审核正常流程测试''' r = requests.patch (self.base_url, data=self.body_data) result = r.json () print(result) self.assertEqual(result["code"],0) self.assertEqual(result["msg"],"成功") def test_store_audit_nodata(self): '''无参数流程测试''' r = requests.patch (self.base_url) result = r.json () print (result) self.assertEqual (result["code"], -2) self.assertEqual (result["msg"], "参数校验有误") def test_store_audit_nostoreid(self): '''无门店ID流程测试''' r = requests.patch (self.base_url,data=self.body_nodata) result = r.json () print (result) self.assertEqual (result["code"], -2) self.assertEqual (result["msg"], "参数校验有误") def test_store_audit_nouserId(self): '''无操作人ID流程测试''' r = requests.patch (self.base_url,data=self.body_nouserId) result = r.json () print (result) self.assertEqual (result["code"], -2) self.assertEqual (result["msg"], "参数校验有误")
class PaymentApplyTest (unittest.TestCase): def setUp(self): self.base_url = "http://10.0.4.66:61020/api/factoring/payment/apply/audit/acceptance" self.case_name = " " self.a = SqlExecution() i = self.a.get_value("SELECT t.`principal_interest_biz_bill_no` FROM `t_loan_order` t " "LEFT JOIN `t_loan_order_payment_apply_bill` t1 " "ON t.`business_order_id` = t1.`business_order_id` " "WHERE t.`status` = 9 " "AND t.`audit_status` !=2 " "AND t1.`sys_flag`=0 " "AND t.`principal_interest_biz_bill_no` IS NOT NULL " "GROUP BY t.`principal_interest_biz_bill_no`;") self.body_data = {"bizBillNo": i, "auditStatus": 3, "userId": 6, "operatorName": "小木鸟" } self.body_wrong_data = {"bizBillNo": 0, "auditStatus": 3, "userId": 6, "operatorName": "小木鸟" } def test_payemnt_apply(self): '''付款申请单审核通过流程校验''' r = requests.patch (self.base_url, data=self.body_data) result = r.json () print (result) self.assertEqual(result["code"],-2) self.assertEqual(result["msg"],"更新订单申请请佣状态失败") def test_payemnt_apply_noparams(self): '''付款申请单审核无参数校验''' r = requests.patch (self.base_url) result = r.json () print (result) self.assertEqual(result["code"],-2) self.assertEqual(result["msg"],"参数校验有误") def test_payemnt_apply_wrongparams(self): '''付款申请单审核错误参数校验''' r = requests.patch (self.base_url,data=self.body_wrong_data) result = r.json () print (result) self.assertEqual(result["code"],-1) self.assertEqual(result["msg"],"未查询到对应的付款申请单")
def setUp(self): self.base_url = "http://10.0.4.66:61020/api/factoring/store/operation/auditAcceptance" self.case_name = " " self.a = SqlExecution () i = self.a.get_value ( "SELECT t.`store_id` FROM `t_enterprise_verification_info` t WHERE t.`audit_status`=0 AND t.`sys_flag`=0 AND t.`status`=2") print(i) self.body_data = {"storeId": i, "userId": 6, "operatorName": "小木鸟", "auditRemark": "自动化测试审核通过" } self.body_nodata = { "userId": 6, "operatorName": "小木鸟", "auditRemark": "自动化测试审核通过" } self.body_nouserId = {"storeId": i, "operatorName": "小木鸟", "auditRemark": "自动化测试审核通过" }
def setUp(self): # 获取当前待生成还款单的请用单号 self.a = SqlExecution() i = self.a.get_value( "SELECT t.`payment_id` FROM `fdd_finance_operation_server`.`t_payment` t WHERE t.payment_status=0 AND t.`fee_type`=1;" ) self.body_data = { "paymentId": str(i), "userId": 6, "userName": "******", "paymentChannel": 90, "paymentType": 1, "paymentMethod": 1, "paymentAccount": "12323213", "paymentAccountName": "小木鸟银行", "paymentBank": "小木鸟支行", "referenceNo": "12321321123" } paymentId = i self.base_url = "http://10.0.4.66:61020/api/payments/" + str( paymentId) + "/payAction" self.case_name = ""
def setUp(self): self.base_url = "http://10.0.4.66:61020/api/factoring/payment/apply/audit/acceptance" self.case_name = " " self.a = SqlExecution() i = self.a.get_value("SELECT t.`principal_interest_biz_bill_no` FROM `t_loan_order` t " "LEFT JOIN `t_loan_order_payment_apply_bill` t1 " "ON t.`business_order_id` = t1.`business_order_id` " "WHERE t.`status` = 9 " "AND t.`audit_status` !=2 " "AND t1.`sys_flag`=0 " "AND t.`principal_interest_biz_bill_no` IS NOT NULL " "GROUP BY t.`principal_interest_biz_bill_no`;") self.body_data = {"bizBillNo": i, "auditStatus": 3, "userId": 6, "operatorName": "小木鸟" } self.body_wrong_data = {"bizBillNo": 0, "auditStatus": 3, "userId": 6, "operatorName": "小木鸟" }
class PayTest(unittest.TestCase): def setUp(self): # 获取当前待生成还款单的请用单号 self.a = SqlExecution() i = self.a.get_value( "SELECT t.`payment_id` FROM `fdd_finance_operation_server`.`t_payment` t WHERE t.payment_status=0 AND t.`fee_type`=1;" ) self.body_data = { "paymentId": str(i), "userId": 6, "userName": "******", "paymentChannel": 90, "paymentType": 1, "paymentMethod": 1, "paymentAccount": "12323213", "paymentAccountName": "小木鸟银行", "paymentBank": "小木鸟支行", "referenceNo": "12321321123" } paymentId = i self.base_url = "http://10.0.4.66:61020/api/payments/" + str( paymentId) + "/payAction" self.case_name = "" def test_pay(self): '''正常付款成功接口测试''' r = requests.post(self.base_url, data=self.body_data) result = r.json() print(result) self.assertEqual(result["code"], 0) self.assertEqual(result["msg"], "成功") def test_pay_nodata(self): '''付款无参数传输接口测试''' r = requests.post(self.base_url) result = r.json() print(result) self.assertEqual(result["code"], -2) self.assertEqual(result["msg"], "参数校验有误")
class OrderAuditTest(unittest.TestCase): def setUp(self): self.base_url = "http://10.0.4.66:61020/api/order/apply/acceptance" self.case_name = " " self.a = SqlExecution() i = self.a.get_value( "SELECT t.`program_id` FROM `t_order_apply` t WHERE t.`audit_status`=0 AND t.`sys_flag`=0 AND t.`channel_id`IS NULL;" ) print(i) self.body_data = { "programId": i, "userId": 6, "operatorName": "小木鸟", "channelId": 4, "remark": "接口测试自动审核" } self.body_nodata = { "userId": 6, "operatorName": "小木鸟", "channelId": 4, "remark": "接口测试自动审核" } self.body_nouserId = { "programId": i, "operatorName": "小木鸟", "channelId": 4, "remark": "接口测试自动审核" } def test_order_audit(self): '''门店审核正常流程测试''' r = requests.patch(self.base_url, data=self.body_data) result = r.json() print(result) self.assertEqual(result["code"], 0) self.assertEqual(result["msg"], "成功") def test_Order_audit_nodata(self): '''无参数流程测试''' r = requests.patch(self.base_url) result = r.json() print(result) self.assertEqual(result["code"], -2) self.assertEqual(result["msg"], "参数校验有误") def test_Order_audit_noOrderid(self): '''无门店ID流程测试''' r = requests.patch(self.base_url, data=self.body_nodata) result = r.json() print(result) self.assertEqual(result["code"], -2) self.assertEqual(result["msg"], "参数校验有误") def test_Order_audit_nouserId(self): '''无操作人ID流程测试''' r = requests.patch(self.base_url, data=self.body_nouserId) result = r.json() print(result) self.assertEqual(result["code"], -2) self.assertEqual(result["msg"], "参数校验有误")
class PaymentFundTest (unittest.TestCase): def setUp(self): self.base_url = "http://10.0.4.66:61020/api/factoring/payment/apply/bill/creation" self.case_name = "" #获取当前待生成还款单的请用单号 self.a = SqlExecution () i = self.a.get_value ( "SELECT t.`business_order_id` FROM `t_loan_order` t WHERE t.`status`=3 AND t.`sys_flag`=0 AND t.`channel_id` != 4 AND t.`business_order_id` IS NOT NULL;") list = [] list.append (i) #参数 self.body_data = {"businessOrderIdList": list, "billType": 1, "userId": 6, "operatorName": "小木鸟" } self.body_nobusinessOrderIdList = {"billType": 1, "userId": 6, "operatorName": "小木鸟" } self.body_nobillType = {"businessOrderIdList": list, "userId": 6, "operatorName": "小木鸟" } self.body_nooperatorName = {"businessOrderIdList": list, "billType": 1, "userId": 6 } self.header = {"content-type": "application/json"} def test_payment_fund(self): '''正常传参流程验证''' r = requests.post (self.base_url, json=self.body_data) result = r.json () print (result) self.assertEqual (result["code"], 0) def test_payment_fund_nobusinessorderid(self): '''不传请佣单号流程验证''' r = requests.post (self.base_url, json=self.body_nobusinessOrderIdList) result = r.json () print (result) self.assertEqual (result["code"], -2) self.assertEqual (result["msg"], "请佣单号不能为空") def test_payment_fund_nobilltype(self): '''不传业务类型号流程验证''' r = requests.post (self.base_url, json=self.body_nobillType) result = r.json () print (result) self.assertEqual (result["code"], -2) self.assertEqual (result["msg"], "单据类型不能为空") def test_payment_fund_nooperatorname(self): '''不传操作人姓名流程验证''' r = requests.post (self.base_url, json=self.body_nooperatorName) result = r.json () print (result) self.assertEqual (result["code"], -2) self.assertEqual (result["msg"], "操作人名称不能为空") def test_payment_fund_nojson(self): '''不传参流程验证''' r = requests.post (self.base_url) result = r.json () print (result) self.assertEqual (result["code"], 400)