Ejemplo n.º 1
0
    def testPartialPayment(self):
        """
        test body
        :return:
        """
        # set url
        #self.url = common.get_url_from_xml('getModuleList')  #从interfaceURL.xml文件中读取url
        self.url = 'loan/partialPayment'
        configHttp.set_url(self.url)
        print("第一步:设置url  " + self.url)
        header = {}
        configHttp.set_header(header)
        print("第二步:设置header(token等)")
        params = {
            "agreementNo": self.agreementNo,
            "loanId": self.loanId,
            "merchantId": self.merchantId,
            "paramList": [{
                "stage": self.stage
            }]
        }
        publicKey = localReadConfig.get_Secure("public_key")
        secret_key = localReadConfig.get_Secure("secret_key")
        secure = getSecureKey.getParamSecure(params, publicKey, secret_key)
        data = {'params': params}
        data.update(publicKey=publicKey)
        data.update(secureKey=secure)

        # set params
        # data = {"interfaceInfo":{"agent": "android","fingerPrint": "UYGIGVYUGHBNUYFYTGINOK","requestUUID": "6c268717-be27-4e6e-ba90-b27b6f5211fe","version": "1.0.0","latitude": 0,"longitude": 0,"deviceId": "d70a659c-31c3-403f-9160-c4476ea9d5f4","deviceModel": "xiaomi"},"type":1}

        # self.accessToken = getAccessToken.loginTonGetAccessToken(self.phon)
        data = json.JSONEncoder().encode(data)
        configHttp.set_data(data)
        print("第三步:设置发送请求的参数")

        # test interface
        self.time_s = datetime.datetime.now()
        self.return_json = configHttp.post()
        self.time_e = datetime.datetime.now()
        self.time = (self.time_e - self.time_s).total_seconds() * 1000
        #self.time = self.time_e - self.time_s
        method = str(self.return_json.request
                     )[int(str(self.return_json.request).find('[')) +
                       1:int(str(self.return_json.request).find(']'))]
        print("第四步:发送请求\n\t\t请求方法:" + method + "\n\t\t响应时间(ms):" +
              str(self.time))
        # check result
        self.checkResult()
        print("第五步:检查结果")
    def testBindCardWithCode(self):
        """
        test body
        :return:
        """
        # set url
        #self.url = common.get_url_from_xml('getModuleList')  #从interfaceURL.xml文件中读取url
        self.url = 'user/bindCardWithCode'
        configHttp.set_url(self.url)
        print("第一步:设置url  " + self.url)
        localReadConfig = readConfig.ReadConfig()

        #读取配置,自动获得bindserialno、msgcode来绑卡验证
        time.sleep(10)
        self.bindSerialNo = localReadConfig.get_bindSerialNo("bindserial")
        self.merchantId = localReadConfig.get_bindSerialNo("merchantId")
        self.msgCode = input('msgcode: ')
        header = {}
        configHttp.set_header(header)
        print("第二步:设置header(token等)")
        params = {
            "bindSerialNo": self.bindSerialNo,
            "merchantId": self.merchantId,
            "msgCode": self.msgCode
        }
        publicKey = localReadConfig.get_Secure("public_key")
        secret_key = localReadConfig.get_Secure("secret_key")
        secure = getSecureKey.getParamSecure(params, publicKey, secret_key)
        data = {'params': params}
        data.update(publicKey=publicKey)
        data.update(secureKey=secure)
        data = json.JSONEncoder().encode(data)
        configHttp.set_data(data)
        print("第三步:设置发送请求的参数")

        # test interface
        self.time_s = datetime.datetime.now()
        self.return_json = configHttp.post()
        self.time_e = datetime.datetime.now()
        self.time = (self.time_e - self.time_s).total_seconds() * 1000
        #self.time = self.time_e - self.time_s
        method = str(self.return_json.request
                     )[int(str(self.return_json.request).find('[')) +
                       1:int(str(self.return_json.request).find(']'))]
        print("第四步:发送请求\n\t\t请求方法:" + method + "\n\t\t响应时间(ms):" +
              str(self.time))
        # check result
        self.checkResult()
        print("第五步:检查结果")
Ejemplo n.º 3
0
    def testRepeal(self):
        """
        test body
        :return:
        """
        # set url
        #self.url = common.get_url_from_xml('getModuleList')  #从interfaceURL.xml文件中读取url
        self.url = 'loan/repeal'
        configHttp.set_url(self.url)
        #print("实例话" + str(datetime.datetime.now()))
        localReadConfig = readConfig.ReadConfig()
        print("第一步:设置url  " + self.url)
        time.sleep(10)
        print(str(datetime.datetime.now()) + "读入时间")
        #通过读取配置loanid,来自动执行撤销用例
        self.loanId = localReadConfig.get_loan("loanid")
        self.merchantId = localReadConfig.get_loan("merchantId")
        header = {}
        configHttp.set_header(header)
        print("第二步:设置header(token等)")
        params = {
            "loanId": self.loanId,
            "merchantId": self.merchantId,
        }
        publicKey = localReadConfig.get_Secure("public_key")
        secret_key = localReadConfig.get_Secure("secret_key")
        secure = getSecureKey.getParamSecure(params, publicKey, secret_key)
        data = {'params': params}
        data.update(publicKey=publicKey)
        data.update(secureKey=secure)
        data = json.JSONEncoder().encode(data)
        configHttp.set_data(data)
        print("第三步:设置发送请求的参数")

        # test interface
        self.time_s = datetime.datetime.now()
        self.return_json = configHttp.post()
        self.time_e = datetime.datetime.now()
        self.time = (self.time_e - self.time_s).total_seconds() * 1000
        #self.time = self.time_e - self.time_s
        method = str(self.return_json.request
                     )[int(str(self.return_json.request).find('[')) +
                       1:int(str(self.return_json.request).find(']'))]
        print("第四步:发送请求\n\t\t请求方法:" + method + "\n\t\t响应时间(ms):" +
              str(self.time))
        # check result
        self.checkResult()
        print("第五步:检查结果")
Ejemplo n.º 4
0
    def testQueryCredit(self):
        """
        test body
        :return:
            """
        # set url
        # self.url = common.get_url_from_xml('getModuleList')  #从interfaceURL.xml文件中读取url
        self.url = 'loan/homeCase/addLoanAuditData'
        configHttp.set_url(self.url)
        print("第一步:设置url  " + self.url)
        header = {}
        configHttp.set_header(header)
        print("第二步:设置header(token等)")
        params = {
            "attachInfo":
            "{\"consumeList\":[{\"imageUrl\":\"http://qimg.hxnews.com/2019/0130/1548847547452.jpg\"},{\"imageUrl\":\"http://pic30.photophoto.cn/20140302/0035035834818295_b.jpg\"}],\"creditList\":[{\"$ref\":\"$.consumeList[0]\"},{\"$ref\":\"$.consumeList[1]\"}],\"houseList\":[{\"$ref\":\"$.consumeList[0]\"},{\"$ref\":\"$.consumeList[1]\"}],\"idList\":[{\"$ref\":\"$.consumeList[0]\"},{\"$ref\":\"$.consumeList[1]\"}]}",
        }
        params.update(merchantId=self.merchantId)
        params.update(externalUserId=self.externalUserId)
        params.update(productId=self.productId)
        params.update(loanId=self.loanId)
        params.update(childMerchantId=self.childMerchantId)

        publicKey = localReadConfig.get_Secure("public_key")
        secret_key = localReadConfig.get_Secure("secret_key")
        secure = getSecureKey.getParamSecure(params, publicKey, secret_key)
        data = {'params': params}
        data.update(publicKey=publicKey)
        data.update(secureKey=secure)

        data = json.JSONEncoder().encode(data)
        configHttp.set_data(data)
        print("第三步:设置发送请求的参数")

        # test interface
        self.time_s = datetime.datetime.now()
        self.return_json = configHttp.post()
        self.time_e = datetime.datetime.now()
        self.time = (self.time_e - self.time_s).total_seconds() * 1000
        # self.time = self.time_e - self.time_s
        method = str(self.return_json.request
                     )[int(str(self.return_json.request).find('[')) +
                       1:int(str(self.return_json.request).find(']'))]
        print("第四步:发送请求\n\t\t请求方法:" + method + "\n\t\t响应时间(ms):" +
              str(self.time))
        # check result
        self.checkResult()
        print("第五步:检查结果")
    def testDownloadStatement(self):
        """
        test body
        :return:
        """
        # set url
        #self.url = common.get_url_from_xml('getModuleList')  #从interfaceURL.xml文件中读取url
        self.url = 'user/downloadStatement'
        configHttp.set_url(self.url)
        print("第一步:设置url  " + self.url)
        header = {}
        self.accountDate = localReadConfig.get_downloadState("accountDate")
        self.merchantId = localReadConfig.get_downloadState("merchantId")
        self.tradeType = localReadConfig.get_downloadState("tradeType")

        configHttp.set_header(header)
        print("第二步:设置header(token等)")
        params = {
            "accountDate": self.accountDate,
            "merchantId": self.merchantId,
            "tradeType": self.tradeType
        }
        publicKey = localReadConfig.get_Secure("public_key")
        secret_key = localReadConfig.get_Secure("secret_key")
        secure = getSecureKey.getParamSecure(params, publicKey, secret_key)
        data = {'params': params}
        data.update(publicKey=publicKey)
        data.update(secureKey=secure)
        data = json.JSONEncoder().encode(data)
        configHttp.set_data(data)
        print("第三步:设置发送请求的参数")

        # test interface
        self.time_s = datetime.datetime.now()
        self.return_json = configHttp.post()
        self.time_e = datetime.datetime.now()
        self.time = (self.time_e - self.time_s).total_seconds() * 1000
        #self.time = self.time_e - self.time_s
        method = str(self.return_json.request
                     )[int(str(self.return_json.request).find('[')) +
                       1:int(str(self.return_json.request).find(']'))]
        print("第四步:发送请求\n\t\t请求方法:" + method + "\n\t\t响应时间(ms):" +
              str(self.time))
        # check result
        self.checkResult()
        print("第五步:检查结果")
Ejemplo n.º 6
0
    def testAuditApply(self):
        """
        test body
        :return:
        """
        # set url
        #self.url = common.get_url_from_xml('getModuleList')  #从interfaceURL.xml文件中读取url
        self.url = 'user/homeCase/auditApply'  #接口地址
        configHttp.set_url(self.url)
        print("第一步:设置url  " + self.url)
        header = {}
        configHttp.set_header(header)
        print("第二步:设置header(token等)")
        params = {"birthday": self.birthday}
        params.update(business="信息传输、计算机服务和软件业")
        params.update(businessCode="G")
        params.update(cityCode="330100")
        params.update(cityName="杭州市")
        params.update(contacts=[{
            "contactName": "妈妈",
            "contactPhone": "13333333333",
            "relations": 1
        }, {
            "contactName": "媳妇",
            "contactPhone": "13555555555",
            "relations": 2
        }])
        params.update(degreeCode="4")
        params.update(deviceId="uihwewkgeuiy23tiueyqiwt4j")
        params.update(district="下城区71-8")
        params.update(duty="一般管理")
        params.update(dutyCode="2")
        params.update(eduCode="02")
        params.update(externalUserId=self.externalUserId)
        params.update(merchantId=self.merchantId)
        params.update(highestDegree="学士")
        params.update(highestEdu="大学本科")
        params.update(idAddress="杭州市余杭区闲林街道东市街岸上蓝山")
        params.update(idCardFront="http://www.baidu.com/idCardFront.jpg")
        params.update(idCardReverse="http://www.baidu.com/idCardReverse.jpg")
        params.update(identifyNo=self.identifyNo)
        params.update(ip="192.168.100.100")
        params.update(liveStatus="自建")
        params.update(liveStatusCode="10")
        params.update(mail="*****@*****.**")
        params.update(
            notifyUrl="http://ydtest004:35000/live/daStage/notifyAction")
        params.update(phone=self.phone)
        params.update(postCode="5000")
        params.update(productCode=["18", "19", "20"])
        params.update(profession="1-医生")
        params.update(professionCode="01")
        params.update(marryStatus="已婚")
        params.update(provinceCode="330000")
        params.update(provinceName="浙江省")
        params.update(rangeCode="330103")
        params.update(rangeName="下城区")
        params.update(realName=self.realName)
        params.update(sex="m")
        params.update(source="app")
        params.update(title="中级")
        params.update(titleCode="2")
        params.update(unitName="浙江钱塘江水利建筑工程公司")
        publicKey = localReadConfig.get_Secure("public_key")
        secureKey = localReadConfig.get_Secure("secret_key")
        secure = getSecureKey.getParamSecure(params, publicKey, secureKey)
        data = {'params': params}
        data.update(publicKey=publicKey)
        data.update(secureKey=secure)

        # set params
        # data = {"interfaceInfo":{"agent": "android","fingerPrint": "UYGIGVYUGHBNUYFYTGINOK","requestUUID": "6c268717-be27-4e6e-ba90-b27b6f5211fe","version": "1.0.0","latitude": 0,"longitude": 0,"deviceId": "d70a659c-31c3-403f-9160-c4476ea9d5f4","deviceModel": "xiaomi"},"type":1}

        # self.accessToken = getAccessToken.loginTonGetAccessToken(self.phon)
        data = json.JSONEncoder().encode(data)
        configHttp.set_data(data)
        print("第三步:设置发送请求的参数")

        # test interface
        self.time_s = datetime.datetime.now()
        self.return_json = configHttp.post()
        self.time_e = datetime.datetime.now()
        self.time = (self.time_e - self.time_s).total_seconds() * 1000
        #self.time = self.time_e - self.time_s
        method = str(self.return_json.request
                     )[int(str(self.return_json.request).find('[')) +
                       1:int(str(self.return_json.request).find(']'))]
        print("第四步:发送请求\n\t\t请求方法:" + method + "\n\t\t响应时间(ms):" +
              str(self.time))
        time.sleep(5)
        # check result
        self.checkResult()
        print("第五步:检查结果")
Ejemplo n.º 7
0
    def testBindCardApply(self):
        """
        test body
        :return:
        """
        # set url
        #self.url = common.get_url_from_xml('getModuleList')  #从interfaceURL.xml文件中读取url
        self.url = 'user/bindCardApply'
        configHttp.set_url(self.url)
        print("第一步:设置url  " + self.url)
        header = {}
        configHttp.set_header(header)
        print("第二步:设置header(token等)")
        params = {
            "bankAccountName": self.bankAccountName,
            "bankAccountNo": self.bankAccountNo,
            "bankBranch": self.bankBranch,
            "bankId": self.bankId,
            "bankName": self.bankName,
            "idNo": self.idNo,
            "externalUserId": self.externalUserId,
            "ip": "192.168.100.100",
            "merchantId": self.merchantId,
            "mobile": self.mobile,
            "productCode": self.productCode
        }
        publicKey = localReadConfig.get_Secure("public_key")
        secret_key = localReadConfig.get_Secure("secret_key")
        secure = getSecureKey.getParamSecure(params, publicKey, secret_key)
        data = {'params': params}
        data.update(publicKey=publicKey)
        data.update(secureKey=secure)

        # set params
        #data = {"interfaceInfo":{"agent": "android","fingerPrint": "UYGIGVYUGHBNUYFYTGINOK","requestUUID": "6c268717-be27-4e6e-ba90-b27b6f5211fe","version": "1.0.0","latitude": 0,"longitude": 0,"deviceId": "d70a659c-31c3-403f-9160-c4476ea9d5f4","deviceModel": "xiaomi"},"type":1}

        # self.accessToken = getAccessToken.loginTonGetAccessToken(self.phon)
        data = json.JSONEncoder().encode(data)
        configHttp.set_data(data)
        print("第三步:设置发送请求的参数")

        # test interface
        self.time_s = datetime.datetime.now()
        self.return_json = configHttp.post()
        self.time_e = datetime.datetime.now()
        self.time = (self.time_e - self.time_s).total_seconds() * 1000
        #self.time = self.time_e - self.time_s
        method = str(self.return_json.request
                     )[int(str(self.return_json.request).find('[')) +
                       1:int(str(self.return_json.request).find(']'))]
        print("第四步:发送请求\n\t\t请求方法:" + method + "\n\t\t响应时间(ms):" +
              str(self.time))
        # check result
        self.checkResult()
        print("第五步:检查结果")

        #第六步:写入bindserialno
        bindSerialNo = self.info["result"].get('bindSerialNo')
        localReadConfig.set_bindSerialNo("bindserial", str(bindSerialNo))
        print(str(datetime.datetime.now()) + "写入时间")
        print("第六步:写入bindserialno")
Ejemplo n.º 8
0
    def testAdd(self):
        """
        test body
        :return:
        """
        # set url
        #self.url = common.get_url_from_xml('getModuleList')  #从interfaceURL.xml文件中读取url
        self.url = 'loan/add'
        configHttp.set_url(self.url)
        print("第一步:设置url  " + self.url)
        header = {}
        configHttp.set_header(header)
        print("第二步:设置header(token等)")
        params = {
            "attachInfo":
            '{\"attachAuditInfoVO\":{\"address\":\"杭州\",\"bankCardNo\":\"' +
            str(self.bankAccountNo) +
            '\",\"homeBuildArea\":\"122.00\",\"homeCaseArea\":\"120.00\",\"homeCaseInstance\":\"民用\",\"houseProperty\":\"自住\"},'
            '\"consumeList\":[{\"imageUrl\":\"http://pic3.bbzhi.com/xitongbizhi/windows7/computer_win_502627_12.jpg\"},'
            '{\"imageUrl\":\"http://pic3.bbzhi.com/xitongbizhi/windows7/computer_win_502627_12.jpg\"},'
            '{\"imageUrl\":\"http://pic3.bbzhi.com/xitongbizhi/windows7/computer_win_502627_12.jpg\"},{\"imageUrl\":\"http://pic3.bbzhi.com/xitongbizhi/windows7/computer_win_502627_12.jpg\"},{\"imageUrl\":\"http://pic3.bbzhi.com/xitongbizhi/windows7/computer_win_502627_12.jpg\"}],\"creditList\":[{\"imageUrl\":\"http://pic3.bbzhi.com/xitongbizhi/windows7/computer_win_502627_12.jpg\"},{\"imageUrl\":\"http://pic3.bbzhi.com/xitongbizhi/windows7/computer_win_502627_12.jpg\"},{\"imageUrl\":\"http://pic3.bbzhi.com/xitongbizhi/windows7/computer_win_502627_12.jpg\"},{\"imageUrl\":\"http://pic3.bbzhi.com/xitongbizhi/windows7/computer_win_502627_12.jpg\"},{\"imageUrl\":\"http://pic3.bbzhi.com/xitongbizhi/windows7/computer_win_502627_12.jpg\"}],\"houseList\":[{\"imageUrl\":\"http://pic3.bbzhi.com/xitongbizhi/windows7/computer_win_502627_12.jpg\"},{\"imageUrl\":\"http://pic3.bbzhi.com/xitongbizhi/windows7/computer_win_502627_12.jpg\"},{\"imageUrl\":\"http://pic3.bbzhi.com/xitongbizhi/windows7/computer_win_502627_12.jpg\"},{\"imageUrl\":\"http://pic3.bbzhi.com/xitongbizhi/windows7/computer_win_502627_12.jpg\"}],\"idList\":[{\"imageUrl\":\"http://pic3.bbzhi.com/xitongbizhi/windows7/computer_win_502627_12.jpg\"},{\"imageUrl\":\"http://pic3.bbzhi.com/xitongbizhi/windows7/computer_win_502627_12.jpg\"},{\"imageUrl\":\"http://pic3.bbzhi.com/xitongbizhi/windows7/computer_win_502627_12.jpg\"},{\"imageUrl\":\"http://pic3.bbzhi.com/xitongbizhi/windows7/computer_win_502627_12.jpg\"}]}',
        }
        params.update(bankAccountName=self.bankAccountName)
        params.update(bankAccountNo=self.bankAccountNo)
        params.update(bankBranch=self.bankBranch)
        params.update(bankCityName=self.bankCityName)
        params.update(bankId=self.bankId)
        params.update(bankProvinceName=self.bankProvinceName)
        params.update(childMerchantId=self.childMerchantId)
        params.update(contractName="12345678")
        contractNo = ''.join(str(i)
                             for i in random.sample(range(0, 9), 9)) + ''.join(
                                 str(i) for i in random.sample(range(0, 9), 9))
        params.update(contractNo=contractNo)
        params.update(contractParams={})
        params.update(
            contractPath=
            "https://testapi.fadada.com:8443/api//getdocs.action?app_id=401572&timestamp=20181227183004&v=2.0&msg_digest=NkE3MDMzMzFBQTMyOEJFNDZEMTZDNzBFREQ4RDEwRDkzMUM2ODg5NA==&send_app_id=null&transaction_id=510245"
        )
        params.update(deviceId="3164itygrtuwytuygeugruyew")
        params.update(externalOrderId=contractNo)
        params.update(externalOutPaymentNo="123")
        params.update(externalUserId=self.externalUserId)
        params.update(ip="192.168.100.100")
        params.update(memo="备注")
        params.update(merchantId=36)
        params.update(money=self.money)
        params.update(
            notifyUrl="http://ydtest002:35000/live/daStage/notifyAction")
        params.update(outsideOverdueRate=5.0)
        params.update(platformName="好美意")
        params.update(productId=18)
        params.update(reason="借钱")
        params.update(repaymentMode=1)
        params.update(source="app")
        stageList = [{
            "amount":
            self.money / self.stages,
            "discountAmount":
            10000,
            "interestFee":
            self.money / self.stages / 10,
            "repayDate":
            time.strftime('%Y-%m-%d', time.localtime(time.time())),
            "stage":
            i
        } for i in range(1, self.stages + 1)]
        params.update(stageList=stageList)
        params.update(stageType="month")
        params.update(stages=self.stages)
        params.update(telphone=self.telphone)
        publicKey = localReadConfig.get_Secure("public_key")
        secret_key = localReadConfig.get_Secure("secret_key")
        secure = getSecureKey.getParamSecure(params, publicKey, secret_key)
        data = {'params': params}
        data.update(publicKey=publicKey)
        data.update(secureKey=secure)

        # set params
        #data = {"interfaceInfo":{"agent": "android","fingerPrint": "UYGIGVYUGHBNUYFYTGINOK","requestUUID": "6c268717-be27-4e6e-ba90-b27b6f5211fe","version": "1.0.0","latitude": 0,"longitude": 0,"deviceId": "d70a659c-31c3-403f-9160-c4476ea9d5f4","deviceModel": "xiaomi"},"type":1}

        # self.accessToken = getAccessToken.loginTonGetAccessToken(self.phon)
        data = json.JSONEncoder().encode(data)
        configHttp.set_data(data)
        print("第三步:设置发送请求的参数")

        # test interface
        self.time_s = datetime.datetime.now()
        self.return_json = configHttp.post()
        self.time_e = datetime.datetime.now()
        self.time = (self.time_e - self.time_s).total_seconds() * 1000
        #self.time = self.time_e - self.time_s
        method = str(self.return_json.request
                     )[int(str(self.return_json.request).find('[')) +
                       1:int(str(self.return_json.request).find(']'))]
        print("第四步:发送请求\n\t\t请求方法:" + method + "\n\t\t响应时间(ms):" +
              str(self.time))
        # check result
        self.checkResult()
        print("第五步:检查结果")

        #if self.assertEqual(self.info['success'],"true"):
        loan_id = self.info["result"]
        #getSecureKey.getSpzxMain(loan_id)
        print("第六步:下单审核")

        #获取的loanid,写入配置文件
        localReadConfig.set_loan("loanid", loan_id)
        print(str(datetime.datetime.now()) + "写入时间")
        print("第七步:记录借款单")