Example #1
0
    def overdue(period: int,
                environment: str,
                project_id: str,
                day: Optional[int] = None,
                month: Optional[int] = None,
                is_special_repurchase: Optional[bool] = False):
        """
		:param period: 1
		:param environment: test/qa
		:param project_id: str
		:param day: int
		:param month: int
		:param is_special_repurchase: 如果产品为卡卡贷/豆豆钱,则该字段值为True
		:return:
		"""
        plan_pay_date = None
        if all([day, month]):
            raise IOError("逾期时间只能有一个")
        elif (day is None) & (month is None):
            raise IOError("逾期时间至少有一个")
        elif day is not None:
            plan_pay_date = Common.get_new_time("before", "days",
                                                day).split(" ")[0]
        elif month is not None:
            plan_pay_date = str(date.today() -
                                relativedelta(months=month)).split(" ")[0]
        GetSqlData.change_plan_pay_date(environment, project_id, period,
                                        plan_pay_date)
        GetSqlData.change_fee_plan_pay_date(environment, project_id, period,
                                            plan_pay_date)
        Common().trigger_task("overdueForCloudloanJob", environment)
        Assert.check_overdue(period, environment, project_id)
Example #2
0
 def open_several_files(self):
     """
     打开一系列文件
     :return: None
     """
     logging.info('======open_several_files=====')
     self.driver.find_element(By.ID, 'com.yozo.office.en:id/im_title_bar_menu_search').click()  # 点击搜索功能
     self.driver.find_element(By.ID, 'com.yozo.office.en:id/iv_search_search').click()  # 点击搜索按钮
     results_list = self.driver.find_elements(By.ID, 'com.yozo.office.en:id/tv_title')
     for result in results_list:
         result.click()
         self.close_file()
         time.sleep(2)
     Common(self.driver).swipeUp()
     results_list = self.driver.find_elements(By.ID, 'com.yozo.office.en:id/tv_title')
     results_list[-1].click()
     self.close_file()
     self.driver.find_element(By.ID, 'com.yozo.office.en:id/iv_search_back').click()
Example #3
0
def run(device_name, phone_ip, phone_port):
    comm = Common(device_name, phone_ip, phone_port)
    result = comm.is_install()
    if result == 2:
        comm.uninstall_app()
        comm.install_app()
    elif result == 0:
        comm.install_app()

    test_report_dir = '../test_report/'
    test_report_name = comm.get_device_info() + '_' + comm.get_current_time() + '_test_report.html'

    suite = unittest.TestSuite()
    suite.addTest(BaseUnit.parametrize(TestLaunch, comm))

    with open(test_report_dir + test_report_name, 'wb') as f:
        runner = HTMLTestRunner(f)
        runner.run(suite)
Example #4
0
 def setUp(self):
     self.cm = Common()
     self.r = self.cm.conn_redis()
     self.env = sys.argv[3]
Example #5
0
 def setUp(self):
     self.cm = Common()
     self.env = sys.argv[3]
 def test_3_repayment_settle_in_advance(self, r, env):
     """翼支付提前结清"""
     data = excel_table_byname(self.file, 'repayment')
     print("接口名称:%s" % data[0]['casename'])
     param = Common().get_json_data('data', 'yzf_settle_in_advance.json')
     param['repayment'].update({
         "projectId":
         r.get("yzf_repayment_advance_projectId"),
         "sourceRepaymentId":
         Common.get_random("sourceProjectId"),
         "payTime":
         Common.get_time("-"),
         "sourceCreateTime":
         Common.get_time("-"),
         "successAmount":
         103.36
     })
     plan_type = {"Principal": "1", "Interest": "2"}
     for i in param['repaymentDetailList']:
         i.update({
             "sourceRepaymentDetailId":
             Common.get_random("transactionId"),
             "relatedPlanId":
             Common.get_random("sourceProjectId"),
             "payTime":
             Common.get_time("-"),
             "sourceCreateTime":
             Common.get_time("-")
         })
         if i['repaymentPlanType'] == 'Principal':
             this_pay_amount = GetSqlData.get_all_repayment_amount(
                 environment=env,
                 project_id=r.get("yzf_repayment_advance_projectId"))
             i.update({"thisPayAmount": this_pay_amount})
     for i in param['repaymentPlanList']:
         i.update({
             "sourcePlanId": Common.get_random("sourceProjectId"),
             "payTime": Common.get_time("-"),
             "sourceCreateTime": Common.get_time("-")
         })
         if i['repaymentStatus'] == 'repayment_done':
             i.update({
                 "curAmount":
                 GetSqlData.get_all_repayment_amount(
                     environment=env,
                     project_id=r.get("yzf_repayment_advance_projectId")),
                 "payAmount":
                 GetSqlData.get_all_repayment_amount(
                     environment=env,
                     project_id=r.get("yzf_repayment_advance_projectId"))
             })
         else:
             if i['assetPlanOwner'] == 'financePartner':
                 plan_list_detail = GetSqlData.get_user_repayment_detail(
                     project_id=r.get("yzf_repayment_advance_projectId"),
                     environment=env,
                     period=i['period'],
                     repayment_plan_type=plan_type[i['repaymentPlanType']])
                 i.update({
                     "sourcePlanId":
                     plan_list_detail.get('source_plan_id'),
                     "planPayDate":
                     str(plan_list_detail.get("plan_pay_date")),
                     "curAmount":
                     float(plan_list_detail.get("rest_amount")),
                     "payAmount":
                     float(plan_list_detail.get("rest_amount")),
                 })
             elif i['assetPlanOwner'] == 'foundPartner':
                 plan_list_detail = GetSqlData.get_repayment_plan_date(
                     project_id=r.get("yzf_repayment_advance_projectId"),
                     environment=env,
                     repayment_plan_type=plan_type[i['repaymentPlanType']],
                     period=i['period'])
                 i.update({
                     "sourcePlanId":
                     plan_list_detail.get('source_plan_id'),
                     "planPayDate":
                     str(plan_list_detail.get("plan_pay_date")),
                     "curAmount":
                     float(plan_list_detail.get("rest_amount")),
                     "payAmount":
                     float(plan_list_detail.get("rest_amount")),
                 })
     for i in param['feePlanList']:
         i.update({
             "planPayDate": Common.get_time("-"),
             "payTime": Common.get_time("-")
         })
     if len(data[0]['headers']) == 0:
         headers = None
     else:
         headers = json.loads(data[0]['headers'])
     rep = Common.response(faceaddr=data[0]['url'],
                           headers=headers,
                           data=json.dumps(param, ensure_ascii=False),
                           environment=env,
                           product="pintic")
     assert rep['resultCode'] == data[0]['msgCode']
     assert rep['content']['message'] == "交易成功"
     assert rep['resultCode'] == int(data[0]['msgCode'])
 def setUp(self):
     self.cm = Common()
Example #8
0
 def setUp(self):
     self.cm = Common()
     self.r = self.cm.conn_redis()
Example #9
0
 def setUp(self):
     self.cm = Common()
     self.data = self.cm.get_json_data('chezhibao_contract_sign.json')
     self.env = sys.argv[3]
Example #10
0
def get_borrowser():
	'''以字典的形式返回爬取的姓名和身份证号'''
	Common().create_borrowers()
	return excel_table_byname(os.path.dirname(
				os.path.dirname(os.path.abspath(__file__))) + '/data/borrowers.xls','borrowers')[0]
Example #11
0
    def test_105_settle_in_advance_phase_one(self, r, env):
        """橙分期在第一期提前结清"""
        data = excel_table_byname(self.file, 'settle_in_advance')
        param = Common().get_json_data(
            'data', 'cfq_12_periods_settle_in_advance_phase_one.json')
        period = GetSqlData.get_current_period(
            r.get("cfq_12_periods_projectId"), env)
        # 剩余在贷本金
        debt_amount = float(
            GetSqlData.get_debt_amount(r.get("cfq_12_periods_projectId"), env))
        # 当期利息
        rest_interest = float(
            GetSqlData.get_user_repayment_detail(
                project_id=r.get("cfq_12_periods_projectId"),
                environment=env,
                period=period,
                repayment_plan_type="2").get("rest_amount"))
        param['repayment'].update({
            "projectId":
            r.get("cfq_12_periods_projectId"),
            "sourceRepaymentId":
            Common.get_random("sourceProjectId"),
            "payTime":
            Common.get_time("-"),
            "sourceCreateTime":
            Common.get_time("-"),
        })
        plan_type = {"Principal": "1", "Interest": "2", "Fee": '3'}
        for i in param['repaymentDetailList']:
            i.update({
                "sourceRepaymentDetailId":
                Common.get_random("transactionId"),
                "relatedPlanId":
                Common.get_random("sourceProjectId"),
                "payTime":
                Common.get_time("-"),
                "sourceCreateTime":
                Common.get_time("-"),
                "period":
                period
            })
            if i['repaymentPlanType'] == 'Principal':
                i.update({
                    "thisPayAmount":
                    GetSqlData.get_all_repayment_amount(
                        environment=env,
                        project_id=r.get("cfq_12_periods_projectId"))
                })
        for i in param['repaymentPlanList']:
            i.update({
                "sourcePlanId": Common.get_random("sourceProjectId"),
                "payTime": "1970-01-01 00:00:00",
                "sourceCreateTime": Common.get_time("-"),
            })
            if i['repaymentStatus'] == 'repayment_done':
                if i['repaymentPlanType'] == 'Principal':
                    i.update({
                        "curAmount": debt_amount,
                        "payAmount": debt_amount,
                        "planPayDate": Common.get_time("-"),
                        "payTime": Common.get_time("-")
                    })
                elif i['repaymentPlanType'] == 'Interest':
                    i.update({
                        "curAmount": rest_interest,
                        "payAmount": rest_interest,
                        "planPayDate": Common.get_time("-"),
                        "payTime": Common.get_time("-")
                    })
            else:
                if i['assetPlanOwner'] == 'financePartner':
                    plan_list_detail1 = GetSqlData.get_user_repayment_detail(
                        project_id=r.get("cfq_12_periods_projectId"),
                        environment=env,
                        period=i['period'],
                        repayment_plan_type=plan_type[i['repaymentPlanType']])
                    i.update({
                        "sourcePlanId":
                        plan_list_detail1.get('source_plan_id'),
                        "planPayDate":
                        str(plan_list_detail1.get("plan_pay_date")),
                        "curAmount":
                        float(plan_list_detail1.get("rest_amount")),
                        "payAmount":
                        float(plan_list_detail1.get("rest_amount")),
                    })
                elif i['assetPlanOwner'] == 'foundPartner':
                    plan_list_detail2 = GetSqlData.get_repayment_plan_date(
                        project_id=r.get("cfq_12_periods_projectId"),
                        environment=env,
                        repayment_plan_type=plan_type[i['repaymentPlanType']],
                        period=i['period'])
                    i.update({
                        "sourcePlanId":
                        plan_list_detail2.get('source_plan_id'),
                        "planPayDate":
                        str(plan_list_detail2.get("plan_pay_date")),
                        "curAmount":
                        float(plan_list_detail2.get("rest_amount")),
                        "payAmount":
                        float(plan_list_detail2.get("rest_amount")),
                    })
        for i in param['feePlanList']:
            i.update({
                "sourcePlanId": Common.get_random('serviceSn'),
                "planPayDate": Common.get_time('-'),
                'payTime': Common.get_time('-')
            })
        if len(data[0]['headers']) == 0:
            headers = None
        else:
            headers = json.loads(data[0]['headers'])
            rep = Common.response(faceaddr=data[0]['url'],
                                  headers=headers,
                                  data=json.dumps(param, ensure_ascii=False),
                                  environment=env,
                                  product="pintec")

            assert rep['resultCode'] == data[0]['msgCode']
            assert rep['content']['message'] == "交易成功"
            assert rep['resultCode'], int(data[0]['msgCode'])