コード例 #1
0
 def test_4(self, login_fix):
     '''放款详情'''
     s = login_fix
     DF = DRG_func(s)
     result = DF.issu_detail()
     assert result["data"][
         "systemOrderNumber"] == "20200410114901016767001236"
コード例 #2
0
 def test_8(self, login_fix, merchant_login_fix):
     '''单笔放款到银行卡'''
     s = login_fix
     ms = merchant_login_fix
     sj = SF()
     DF = DRG_func(s)
     DM = Drg_merchant(ms)
     #运营端修改商户出金方式为银行卡
     licenceSerialNumber = time.strftime("%Y%m%d%H%M%S")
     smscode = licenceSerialNumber[2:8]
     DF.login_sucess(smscode)
     bankBranchCode = sj.phone()
     # 出金模式银行卡:BANK_CARD
     # 出金模式小程序钱包:APPLET_WALLET
     issuType = "BANK_CARD"
     result = DF.merchant_editDetail_bybankcard(issuType, bankBranchCode)
     #商户端单笔放款到银行卡
     issuname = "郑国"
     issuidCard = "350181199006012155"
     issuamount = "2"
     accountNumber = '6232111820006508170'
     sql = 'select * FROM spman_center.task where  merchant_name = "极限传媒" and status = 1 order by id desc limit 1;'
     r = select_taskid_number(sql)
     taskId = str(r[0]["id"])
     result1 = DM.issu_by_bankcard(issuname, issuidCard, issuamount,
                                   accountNumber, taskId)
     batchNo = result1["data"]["batchNo"]
     result2 = DM.batchIssu_loan(batchNo)
     assert result2["message"]["content"] == "处理中, 请稍后..."
コード例 #3
0
 def test_3(self, login_fix):
     '''付款详情'''
     s = login_fix
     DF = DRG_func(s)
     result = DF.rechargeOrder_detail()
     assert result["data"][
         "systemOrderNumber"] == "10200414103247016873002137"
コード例 #4
0
 def test_2(self, login_fix):
     '''发票申请详情'''
     s = login_fix
     DF = DRG_func(s)
     result = DF.invoice_detail()
     assert result["data"]["resultList"]["dataList"][0][
         "batchNumber"] == "BATCH00000947"
コード例 #5
0
 def test_1(self,login_fix):
     '''获取承揽方信息'''
     s = login_fix
     DF = DRG_func(s)
     u_list = DF.get_user_list()
     #3.断言
     assert u_list["data"]["pageSize"] == 20
コード例 #6
0
 def test_4(self, login_fix):
     '''员工管理-员工角色页面-删除员工'''
     s = login_fix
     DF = DRG_func(s)
     result_id = DF.add_account()  #新增用户,返回用户id
     id = result_id["data"]["id"]
     result = DF.delete_account(id)  #删除用户
     assert result["message"]["content"] == "操作成功"
コード例 #7
0
 def test_1(self, lg):
     '''获取承揽方信息'''
     s = lg
     DF = DRG_func(s)
     u_list = DF.get_user_list()
     print(u_list)
     # 3.断言
     assert u_list["data"]["pageSize"] == 20
コード例 #8
0
    def test_1(self, merchant_login_fix, login_fix):
        '''开票申请'''
        sf = SF()
        channelOrderNumber = sf.channelOrderNumber()
        amount = sf.day()
        s = login_fix
        DF = DRG_func(s)
        paytime = time.strftime("%Y" + "-" + "%m" + "-" + "%d" + " " + "%H" +
                                ":" + "%M" + ":" + "%S")
        ms = merchant_login_fix
        DM = Drg_merchant(ms)
        #查询是否有开票充值记录
        r = DM.rechargeOrder_wait()
        rechargeCount = r["data"]["rechargeCount"]
        #判断充值记录为0的情况下
        if rechargeCount == 0:
            #新增充值记录
            print("新增充值")
            DM.merchant_recharge(amount, channelOrderNumber)
            #运营端确认
            sysnumber1 = DF.wait_order()
            sysnumber = sysnumber1["data"]["resultList"]["dataList"][0][
                "systemOrderNumber"]
            DF.sucess_order(paytime, sysnumber)
            print("运营端确认充值记录")
            # 查询开票充值几率不为0的情况下开票申请,先查询出开票充值记录里面的充值金额和系统单号
            recharge_detail = DM.rechargeOrder_wait()
            totalAmount = recharge_detail["data"]["resultList"]["dataList"][0][
                "amountStr"]
            s_totalAmount = recharge_detail["data"]["resultList"]["dataList"][
                0]["amountStr"]
            systemOrderNumbers = recharge_detail["data"]["resultList"][
                "dataList"][0]["systemOrderNumber"]
            print("查询开票充值记录,返回税价合计金额、放款单号")
            # 提交开票申请
            result = DM.invoice_apply(totalAmount, systemOrderNumbers,
                                      s_totalAmount)
            print("提交开票申请成功")
            assert result["message"]["content"] == "操作成功"

        else:
            #不为0的情况下开票申请,先查询出开票充值记录里面的充值金额和系统单号
            print("查询开票充值记录,返回税价合计金额、放款单号")
            recharge_detail = DM.rechargeOrder_wait()
            totalAmount = recharge_detail["data"]["resultList"]["dataList"][0][
                "amountStr"]
            s_totalAmount = recharge_detail["data"]["resultList"]["dataList"][
                0]["amountStr"]
            systemOrderNumbers = recharge_detail["data"]["resultList"][
                "dataList"][0]["systemOrderNumber"]
            #提交开票申请
            result = DM.invoice_apply(totalAmount, systemOrderNumbers,
                                      s_totalAmount)
            print("提交开票申请成功")
            assert result["message"]["content"] == "操作成功"
コード例 #9
0
 def test_10(self, login_fix):
     '''修改商户出金方式为小程序钱包'''
     s = login_fix
     DF = DRG_func(s)
     sj = SF()
     # 分行CODE前端随机生成
     bankBranchCode = sj.phone()
     # 出金模式银行卡:BANK_CARD
     # 出金模式小程序钱包:APPLET_WALLET
     issuType = "APPLET_WALLET"
     result = DF.merchant_editDetail_bybankcard(issuType, bankBranchCode)
     assert result["message"]["content"] == "更新成功"
コード例 #10
0
    def test_4(self,login_fix):
        '''新增发包方'''
        s = login_fix
        sj = SF()
        accountName = sj.name()
        contactMail = sj.get_email()
        contactName = sj.name()
        licenceSerialNumber = time.strftime("%Y%m%d%H%M%S")
        shortName = sj.name()
        managerMobile = sj.phone()

        DF = DRG_func(s)
        result = DF.add_merchant(accountName,contactMail,contactName,licenceSerialNumber,shortName,managerMobile)#参数顺序要和方法一致
        print(result)
コード例 #11
0
 def test_1(self, login_fix, merchant_login_fix):
     '''确认充值订单'''
     s = login_fix
     ms = merchant_login_fix
     sf = SF()
     channelOrderNumber = sf.channelOrderNumber()
     DM = Drg_merchant(ms)
     DF = DRG_func(s)
     paytime = time.strftime("%Y" + "-" + "%m" + "-" + "%d" + " " + "%H" +
                             ":" + "%M" + ":" + "%S")
     #查询是否有未确认订单
     r1 = DF.all_wait_order()
     #如果等于0
     if r1 == 0:
         #商户端新增充值
         DM.merchant_recharge(channelOrderNumber)
         #运营端确认订单
         sysnb = DF.wait_order()
         sysnumber = sysnb["data"]["resultList"]["dataList"][0][
             "systemOrderNumber"]
         result = DF.sucess_order(paytime, sysnumber)
         assert result["message"]["content"] == "确认成功"
     else:
         #不等于0查询系统单号,确认订单
         sysnb = DF.wait_order()
         sysnumber = sysnb["data"]["resultList"]["dataList"][0][
             "systemOrderNumber"]
         result = DF.sucess_order(paytime, sysnumber)
         assert result["message"]["content"] == "确认成功"
コード例 #12
0
ファイル: conftest.py プロジェクト: zguo0601/darg_api
def login_fix(request):
    #相当于打开浏览器
    session = requests.session()
    code = time.strftime("%Y%m%d%H%M%S")
    smscode = code[2:8]
    DF = DRG_func(session)
    DF.login_sucess(smscode)
    print("登录成功")
    #这里yield s返回的是最新的cookie
    yield session

    #关闭session
    def close_s():
        session.close()

    # 终结'''自定义一个前置操作'''
    request.addfinalizer(close_s)
    print("退出登录")
コード例 #13
0
 def setup_class(cls):
     # 前置条件,打开浏览器
     cls.s = requests.session()
     # 操作步骤:1.实例化DRG_func(s)
     cls.DF = DRG_func(cls.s)
     code = time.strftime("%Y%m%d%H%M%S")
     smscode = code[2:8]
     # 2.获取验证码+获取登录成功
     cls.DF.login_sucess(smscode)
コード例 #14
0
 def test_10(self, login_fix, merchant_login_fix):
     '''保存订单至:未支付-待放款后,放款至银行卡'''
     s = login_fix
     ms = merchant_login_fix
     sj = SF()
     DF = DRG_func(s)
     DM = Drg_merchant(ms)
     # 运营端修改商户出金方式为银行卡
     licenceSerialNumber = time.strftime("%Y%m%d%H%M%S")
     smscode = licenceSerialNumber[2:8]
     DF.login_sucess(smscode)
     bankBranchCode = sj.phone()
     # 出金模式银行卡:BANK_CARD
     # 出金模式小程序钱包:APPLET_WALLET
     issuType = "BANK_CARD"
     result = DF.merchant_editDetail_bybankcard(issuType, bankBranchCode)
     # 商户端单笔放款到银行卡
     issuname = "郑国"
     issuidCard = "350181199006012155"
     issuamount = "2"
     accountNumber = '6232111820006508170'
     sql = 'select * FROM spman_center.task where  merchant_name = "极限传媒" and status = 1 order by id desc limit 1;'
     r = select_taskid_number(sql)
     taskId = str(r[0]["id"])
     result1 = DM.issu_by_bankcard(issuname, issuidCard, issuamount,
                                   accountNumber, taskId)
     batchNo = result1["data"]["batchNo"]
     #保存验证成功订单
     result2 = DM.save_Verify_SuccessOrder(batchNo)
     #查询订单详情
     result3 = DM.SuccessOrder_list(batchNo)
     #查询放款单号
     systemOrderNumbers = result3["data"]["dataList"][0][
         "systemOrderNumber"]
     #未支付-待放款后,放款至银行卡
     result4 = DM.preSave_Loan(systemOrderNumbers)
     assert result4["message"]["content"] == "处理中, 请稍后..."
コード例 #15
0
 def test_8(self,login_fix):
     '''新增子公司'''
     #获取子公司列表,判断,如果有子公司的话,获取子公司id,删除之后再新增。
     # 没有的话新增子公司
     s = login_fix
     DF = DRG_func(s)
     sl = DF.sub_list()
     d_l = sl["data"]["total"]
     if d_l == 0:
         result = DF.add_sub()
         assert result["message"]["content"] == "新增成功"
     else:
         mid = sl["data"]["dataList"][0]["merchantRelationId"]
         DF.del_sub(mid,)
         result = DF.add_sub()
         assert result["message"]["content"] == "新增成功"
コード例 #16
0
 def test_1(self, login_fix):
     '''上传完税证明'''
     s = login_fix
     DF = DRG_func(s)
     result = DF.update_apply()
     assert result["message"]["content"] == "上传成功"
コード例 #17
0
 def test_13(self, login_fix):
     '''通道钱包详情'''
     s = login_fix
     DF = DRG_func(s)
     result = DF.channelWallet_selectOne()
     assert result["data"]["name"] == "民生银行-银企直联"
コード例 #18
0
 def test_5(self, login_fix):
     '''批量放款记录'''
     s = login_fix
     DF = DRG_func(s)
     result = DF.issuBatchApply_detail()
     assert result["data"]["total"] > 0
コード例 #19
0
 def test_6(self, login_fix):
     '''批量放款记录'''
     s = login_fix
     DF = DRG_func(s)
     result = DF.batch_issu_detail()
     assert result["data"]["dataList"][0]["batchNumber"] == "BATCH00001080"
コード例 #20
0
 def test_3(self, login_fix):
     '''付款记录'''
     s = login_fix
     DF = DRG_func(s)
     result = DF.issu_list()
     assert result["message"]["content"] == "查询成功"
コード例 #21
0
 def test_10(self, login_fix):
     '''承揽方钱包详情'''
     s = login_fix
     DF = DRG_func(s)
     result = DF.userWallet_selectOne()
     assert result["data"]["name"] == "郑国"
コード例 #22
0
 def test_2(self,login_fix):
     '''赏金详情'''
     s = login_fix
     DF = DRG_func(s)
     result = DF.withdrawOrder_detail()
     assert result["data"]["orderStatusStr"] == "提取成功"
コード例 #23
0
 def test_2(self, login_fix):
     '''重传结算单'''
     s = login_fix
     DF = DRG_func(s)
     result = DF.upload_Attachment()
     assert result["message"]["content"] == "上传成功"
コード例 #24
0
 def test_1(self,login_fix):
     '''赏金记录查询'''
     s = login_fix
     DF = DRG_func(s)
     result = DF.withdrawOrder_list()
     assert result["data"]["resultList"]["pageSize"] == 20
コード例 #25
0
 def test_11(self, login_fix):
     '''平台钱包'''
     s = login_fix
     DF = DRG_func(s)
     result = DF.systemWallet_selectOne()
     assert result["data"]["name"] == "综合服务费钱包-系统"
コード例 #26
0
 def test_12(self, login_fix):
     '''通道钱包'''
     s = login_fix
     DF = DRG_func(s)
     result = DF.channelWallet_list()
     assert result["data"]["dataList"][0]["name"] == "第三方-日常测试"
コード例 #27
0
 def test_5(self, login_fix, merchant_login_fix):
     '''开票申请'''
     s = login_fix
     ms = merchant_login_fix
     sj = SF()
     DF = DRG_func(s)
     DM = Drg_merchant(ms)
     #运营端开票时间
     invoiceDate = time.strftime("%Y" + "-" + "%m" + "-" + "%d" + " " +
                                 "%H" + ":" + "%M" + ":" + "%S")
     #发票代码
     invoiceCode = sj.phone()
     #发票号码
     invoiceNumber = sj.phone()
     #快递单号
     emsOrderNumber = sj.phone()
     #商户端充值通道单号(随机生成)
     channelOrderNumber = sj.channelOrderNumber()
     #商户端充值金额
     recharge_amount = sj.day()
     #---------运营端确认充值订单,查询放款单号-------------------------------------------------
     sysnumber1 = DF.wait_order()
     sysnumber = sysnumber1["data"]["resultList"]["dataList"][0][
         "systemOrderNumber"]
     # ----------商户端,查询出开票充值记录里面的充值金额和系统单号---------------------------------
     recharge_detail = DM.rechargeOrder_wait()
     m_totalAmount = recharge_detail["data"]["resultList"]["dataList"][0][
         "amountStr"]
     s_totalAmount = recharge_detail["data"]["resultList"]["dataList"][0][
         "amountStr"]  #格式化输出,将字典里面的值参数化
     systemOrderNumbers = recharge_detail["data"]["resultList"]["dataList"][
         0]["systemOrderNumber"]
     #-------查询是否有待处理开票订单-------------------------------------------------------------------------------------
     applyStatus = 'WAIT'
     apply = DF.invoice_apply_list(applyStatus)
     apply_result = apply["data"]["count"]
     if apply_result == 0:
         #新增开票申请
         # ------查询是否有开票充值记录-----
         r = DM.rechargeOrder_wait()
         rechargeCount = r["data"]["rechargeCount"]
         # 判断充值记录为0的情况下
         if rechargeCount == 0:
             # 新增充值记录
             DM.merchant_recharge(recharge_amount, channelOrderNumber)
             # 运营端确认
             DF.sucess_order(invoiceDate, sysnumber)
             # 商户端提交开票申请
             DM.invoice_apply(m_totalAmount, systemOrderNumbers,
                              s_totalAmount)
             # 运营端新增开票信息
             # --------运营端查询,返回税价合计金额、批次号、用户编号、根据税价合计计算出 金额和 税额-----------
             applyStatus = 'WAIT'
             r2 = DF.invoice_apply_list(applyStatus)
             totalAmount1 = r2["data"]["resultList"]["dataList"][0][
                 "totalAmount"]  # 获取税价合计金额,类型为 str
             batchNumber = r2["data"]["resultList"]["dataList"][0][
                 "batchNumber"]  # 获取批次号
             merchantNumber = r2["data"]["resultList"]["dataList"][0][
                 "merchantNumber"]  # 获取用户编号
             f_totalAmount = float(totalAmount1)  # 类型为str的金额转化为 浮点型
             y_totalAmount = round(f_totalAmount, 2)  # 浮点型 税价合计金额 四舍五入
             f_amount = y_totalAmount / (1 + 0.1)  # 税率10%
             amount = round(f_amount, 2)  # 金额
             f_taxAmount = y_totalAmount - amount
             taxAmount = round(f_taxAmount, 2)  # 税额
             # 申请合并开票
             r3 = DF.invoice_merger(batchNumber, merchantNumber)
             # 查询开票中订单
             applyStatus = 'HANDLE'
             r4 = DF.invoice_apply_list(applyStatus)
             # 返回合并开票批次号 invoiceBatchNumber
             invoiceBatchNumber = r4["data"]["resultList"]["dataList"][0][
                 "invoiceBatchNumber"]
             DF.invoice_add(invoiceCode, invoiceDate, invoiceNumber,
                            taxAmount, y_totalAmount, amount,
                            invoiceBatchNumber, merchantNumber)
             # 填写快递单号,确认开票申请
             result = DF.invoice_addEmsInfo(batchNumber, merchantNumber,
                                            invoiceBatchNumber,
                                            emsOrderNumber)
             assert result["message"]["content"] == "操作成功"
         else:
             # 商户端提交开票申请
             DM.invoice_apply(m_totalAmount, systemOrderNumbers,
                              s_totalAmount)
             # 运营端新增开票信息
             # --------运营端查询,返回税价合计金额、批次号、用户编号、根据税价合计计算出 金额和 税额-----------
             applyStatus = 'WAIT'
             r2 = DF.invoice_apply_list(applyStatus)
             totalAmount1 = r2["data"]["resultList"]["dataList"][0][
                 "totalAmount"]  # 获取税价合计金额,类型为 str
             batchNumber = r2["data"]["resultList"]["dataList"][0][
                 "batchNumber"]  # 获取批次号
             merchantNumber = r2["data"]["resultList"]["dataList"][0][
                 "merchantNumber"]  # 获取用户编号
             f_totalAmount = float(totalAmount1)  # 类型为str的金额转化为 浮点型
             y_totalAmount = round(f_totalAmount, 2)  # 浮点型 税价合计金额 四舍五入
             f_amount = y_totalAmount / (1 + 0.1)  # 税率10%
             amount = round(f_amount, 2)  # 金额
             f_taxAmount = y_totalAmount - amount
             taxAmount = round(f_taxAmount, 2)  # 税额
             # 申请合并开票
             r3 = DF.invoice_merger(batchNumber, merchantNumber)
             # 查询开票中订单
             applyStatus = 'HANDLE'
             r4 = DF.invoice_apply_list(applyStatus)
             # 返回合并开票批次号 invoiceBatchNumber
             invoiceBatchNumber = r4["data"]["resultList"]["dataList"][0][
                 "invoiceBatchNumber"]
             DF.invoice_add(invoiceCode, invoiceDate, invoiceNumber,
                            taxAmount, y_totalAmount, amount,
                            invoiceBatchNumber, merchantNumber)
             # 填写快递单号,确认开票申请
             result = DF.invoice_addEmsInfo(batchNumber, merchantNumber,
                                            invoiceBatchNumber,
                                            emsOrderNumber)
             assert result["message"]["content"] == "操作成功"
     else:
         # 运营端新增开票信息
         # --------运营端查询,返回税价合计金额、批次号、用户编号、根据税价合计计算出 金额和 税额-----------
         applyStatus = 'WAIT'
         r2 = DF.invoice_apply_list(applyStatus)
         totalAmount1 = r2["data"]["resultList"]["dataList"][0][
             "totalAmount"]  # 获取税价合计金额,类型为 str
         batchNumber = r2["data"]["resultList"]["dataList"][0][
             "batchNumber"]  # 获取批次号
         merchantNumber = r2["data"]["resultList"]["dataList"][0][
             "merchantNumber"]  # 获取用户编号
         f_totalAmount = float(totalAmount1)  # 类型为str的金额转化为 浮点型
         y_totalAmount = round(f_totalAmount, 2)  # 浮点型 税价合计金额 四舍五入
         f_amount = y_totalAmount / (1 + 0.1)  # 税率10%
         amount = round(f_amount, 2)  # 金额
         f_taxAmount = y_totalAmount - amount
         taxAmount = round(f_taxAmount, 2)  # 税额
         # 申请合并开票
         r3 = DF.invoice_merger(batchNumber, merchantNumber)
         # 查询开票中订单
         applyStatus = 'HANDLE'
         r4 = DF.invoice_apply_list(applyStatus)
         # 返回合并开票批次号 invoiceBatchNumber
         invoiceBatchNumber = r4["data"]["resultList"]["dataList"][0][
             "invoiceBatchNumber"]
         DF.invoice_add(invoiceCode, invoiceDate, invoiceNumber, taxAmount,
                        y_totalAmount, amount, invoiceBatchNumber,
                        merchantNumber)
         # 填写快递单号,确认开票申请
         result = DF.invoice_addEmsInfo(batchNumber, merchantNumber,
                                        invoiceBatchNumber, emsOrderNumber)
         assert result["message"]["content"] == "操作成功"
コード例 #28
0
 def test_username(self, test_input, expect):
     '''登录用户名测试'''
     s = requests.session()
     DF = DRG_func(s)
     result = DF.get_Login(test_input)
     assert result["message"]["content"] == expect["message"]["content"]
コード例 #29
0
 def test_password(self):
     '''登录密码错误11'''
     s = requests.session()
     DF = DRG_func(s)
     result = DF.get_password()
     assert "密码错误" in result
コード例 #30
0
 def test_4(self, login_fix):
     '''已开发票详情'''
     s = login_fix
     DF = DRG_func(s)
     result = DF.invoice_info_detail()
     assert result["data"]["batchNumber"] == "BATCH00001517"