def test_1_sPfsnByOnScholarship(self): '''随机获取成教专业''' intFile = YamlParser('StudentInfo') extFile = YamlParser('LearnInfo') grade = intFile.getYamlParms(('CJ', 'grade')) level = intFile.getYamlParms(('CJ', 'level')) sId = extFile.getYamlParms(('CStudent', 'unvsId')) values = (grade, level, sId) keys = (('data', 'ext2'), ('data', 'ext1'), ('data', 'sId')) case = TestCaseAssembly().setAipParam('sPfsnByOnScholarship', values, keys) response = YzApi().lapi(method=case[0], headers=case[1], urls=case[2], data=case[3]) self.assertTrue(MyAssert().assertchar(response.text, ['true', '00']), True) '''提取参数''' AfterParamCom().saveParam(response.text, 'sPfsnByOnScholarship', ('CStudent', 'pfsnId'))
def test_3_getOpenPfsnByTaId(self): '''随机获取国开报读专业pfsnId+专业名称pfsnName+专业编号pfsnCode''' intFile = YamlParser('StudentInfo') extFile = YamlParser('LearnInfo') case = TestCaseAssembly().setAipParam( 'getOpenPfsnByTaId', (intFile.getYamlParms( ('GK', 'level')), intFile.getYamlParms( ('GK', 'grade')), extFile.getYamlParms( ('GStudent', 'taId'))), (('data', 'ext2'), ('data', 'ext3'), ('data', 'ext1'))) response = YzApi().lapi(method=case[0], headers=case[1], urls=case[2], data=case[3]) self.assertTrue(MyAssert().assertchar(response.text, ['true', '00']), True) '''提取参数''' AfterParamCom().saveParam(response.text, 'getOpenPfsnByTaId', (('GStudent', 'pfsnId'), ('GStudent', 'pfsnName'), ('GStudent', 'pfsnCode')))
def test_3_showFeeList(self): '''获取收费标准''' extFile = YamlParser('LearnInfo') intFile = YamlParser('StudentInfo') pfsnId = extFile.getYamlParms(('CStudent', 'pfsnId')) taId = extFile.getYamlParms(('CStudent', 'taId')) recruitType = intFile.getYamlParms(('CJ', 'recruitType')) scholarship = intFile.getYamlParms(('CJ', 'scholarships')) values = (pfsnId, taId, recruitType, scholarship) keys = (('data', 'pfsnId'), ('data', 'taId'), ('data', 'recruitType'), ('data', 'scholarship')) case = TestCaseAssembly().setAipParam('showFeeList', values, keys) response = YzApi().lapi(method=case[0], headers=case[1], urls=case[2], data=case[3]) self.assertTrue(MyAssert().assertchar(response.text, ['true', '00']), True) '''提取参数''' AfterParamCom().saveParam(response.text, 'showFeeList', ('CStudent', 'feeList'))
def test_J_stdEnroll_enroll(self): '''成教学员录取''' extFile = YamlParser('LearnInfo') intFile = YamlParser('StudentInfo') level = intFile.getYamlParms(('CJ', 'level')) learnId = extFile.getYamlParms(('CStudent', 'learnId')) grade = intFile.getYamlParms(('CJ', 'grade')) pfsnId = extFile.getYamlParms(('CStudent', 'pfsnId')) unvsId = extFile.getYamlParms(('CStudent', 'unvsId')) case = TestCaseAssembly().setAipParam( 'stdEnroll', (learnId, level, grade, pfsnId, unvsId), (('data', 'learnId'), ('data', 'level'), ('data', 'grade'), ('data', 'pfsnId'), ('data', 'unvsId'))) response = YzApi().lapi(method=case[0], headers=case[1], urls=case[2], data=case[3]) '''断言''' self.assertTrue(MyAssert().assertchar(response.text, ['true', '00']), True)
def test_D_annexCheckCharge(self): '''成教学员附件审核-附件审核''' extFile = YamlParser('LearnInfo') annexId1 = extFile.getYamlParms(('CStudent', 'annexId1')) annexId2 = extFile.getYamlParms(('CStudent', 'annexId2')) annexId3 = extFile.getYamlParms(('CStudent', 'annexId3')) annexId4 = extFile.getYamlParms(('CStudent', 'annexId4')) learnId = extFile.getYamlParms(('CStudent', 'learnId')) annexId = [annexId1, annexId2, annexId3, annexId4] assert0 = True for i in annexId: case = TestCaseAssembly().setAipParam('annexCheckCharge', (i, learnId), (('data', 'annexId'), ('data', 'learnId'))) response = YzApi().lapi(method=case[0], headers=case[1], urls=case[2], data=case[3]) assert1 = MyAssert().assertchar(response.text, ['true', '00']) assert0 = assert0 and assert1
def test_d_studentModify_insertStudentModify(self): '''成教学员新生信息修改发起申请''' extFile = YamlParser('LearnInfo') npfsnLevel = extFile.getYamlParms(('CStudent', 'npfsnLevel')) newPfsnId = extFile.getYamlParms(('CStudent', 'newPfsnId')) newTaId = extFile.getYamlParms(('CStudent', 'newTaId')) newUnvsId = extFile.getYamlParms(('CStudent', 'sId')) TxJosn = extFile.getYamlParms(('CStudent', 'TxJosn')) case = TestCaseAssembly().setAipParam( 'insertStudentModify', (npfsnLevel, newPfsnId, newTaId, newUnvsId), (('data', 'npfsnLevel'), ('data', 'newPfsnId'), ('data', 'newTaId'), ('data', 'newTaId'))) case[3].update(TxJosn) response = YzApi().lapi(method=case[0], headers=case[1], urls=case[2], data=case[3]) '''断言''' self.assertTrue(MyAssert().assertchar(response.text, ['true', '00']), True)
def test_c_testArea_findBdTestAreaNotStop(self): '''成教学员新生信息修改申请随机获取新考区id''' intFile = YamlParser('StudentInfo') extFile = YamlParser('LearnInfo') scholarship = intFile.getYamlParms(('CJ', 'scholarships')) newPfsnId = extFile.getYamlParms(('CStudent', 'newPfsnId')) case = TestCaseAssembly().setAipParam('findBdTestAreaNotStop', (scholarship, newPfsnId), (('data', 'scholarship'), ('data', 'newPfsnId'))) response = YzApi().lapi(method=case[0], headers=case[1], urls=case[2], data=case[3]) '''断言''' self.assertTrue(MyAssert().assertchar(response.text, ['true', '00']), True) '''提取参数cpfsnId''' AfterParamCom().saveParam(response.text, 'findBdTestAreaNotStop', ('CStudent', 'newTaId'))
def test_7_cj_fd_pay(self): '''成教学员支付辅导费(不使用抵扣)''' extFile = YamlParser('LearnInfo') intFile = YamlParser('StudentInfo') '''提取到的''' order = extFile.getYamlParms(('CStudent', 'order')) learnId = extFile.getYamlParms(('CStudent', 'learnId')) web_token = extFile.getYamlParms(('CStudent', '_web_token')) tutorPayInfos = getJsonParm(order, 'tutorPayInfos')[0] payAmount = payableCount = amount = tutorPayInfos['payable'] itemName = tutorPayInfos['itemName'] orderNo = tutorPayInfos['subOrderNo'] paymentType = 1 '''配置的''' grade = intFile.getYamlParms(('CJ', 'grade')) values = (str(learnId), str(learnId), str(web_token), str(grade), str(grade), str(payableCount), str(payAmount), str(payAmount), str(amount), str(itemName), str(orderNo), str(paymentType)) keys = (('data', 'learnId'), ('data', 'payData', 'learnId'), ('data', '_web_token'), ('data', 'grade'), ('data', 'payData', 'grade'), ('data', 'payableCount'), ('data', 'payData', 'payAmount'), ('data', 'payData', 'items', 0, 'payAmount'), ('data', 'payData', 'items', 0, 'amount'), ('data', 'payData', 'items', 0, 'itemName'), ('data', 'payData', 'items', 0, 'orderNo'), ('data', 'paymentType')) case = TestCaseAssembly().setAipParam('pay', values, keys) case[3]['payData'] = str(case[3]['payData']) response = YzApi().lapi(method=case[0], headers=DataSource().getHearder("PHearder"), urls=case[2], data=case[3]) '''提取参数:subOrderNo''' DataSource().setLearnInfo('CStudent', 'subOrderNo', orderNo) '''断言''' self.assertTrue(MyAssert().assertchar(response.text, ['true', '00']), True)
def test_4_showFeeList(self): '''获取国开报读收费标准信息''' intFile = YamlParser('StudentInfo') extFile = YamlParser('LearnInfo') case = TestCaseAssembly().setAipParam( 'showFeeList', (intFile.getYamlParms(('GK', 'recruitType')), intFile.getYamlParms(('GK', 'scholarships')), extFile.getYamlParms(('GStudent', 'pfsnId')), extFile.getYamlParms(('GStudent', 'taId'))), (('data', 'recruitType'), ('data', 'scholarship'), ('data', 'pfsnId'), ('data', 'taId'))) response = YzApi().lapi(method=case[0], headers=case[1], urls=case[2], data=case[3]) self.assertTrue(MyAssert().assertchar(response.text, ['true', '00']), True) '''提取参数''' AfterParamCom().saveJson(response.text, (('body', 'feeInfo', 'feeId'), ), (('GStudent', 'feeId'), )) AfterParamCom().saveParam(response.text, 'showFeeList', ('GStudent', 'feeList'))
def test_4_CrecruitAdd(self): '''随机注册成教学员''' extFile = YamlParser('LearnInfo') intFile = YamlParser('StudentInfo') '''提取到的''' unvsid = extFile.getYamlParms(('CStudent', 'unvsId')) pfsnId = extFile.getYamlParms(('CStudent', 'pfsnId')) taId = extFile.getYamlParms(('CStudent', 'taId')) feeList = extFile.getYamlParms(('CStudent', 'feeList')) '''配置的''' scholarship = intFile.getYamlParms(('CJ', 'scholarships')) recruitType = intFile.getYamlParms(('CJ', 'recruitType')) grade = intFile.getYamlParms(('CJ', 'grade')) pfsnLevel = intFile.getYamlParms(('CJ', 'level')) mobile = BeforeParamCom().getPhone() idCard = BeforeParamCom().getCard() self.log.info('学员手机号:' + mobile) self.log.info('学员身份证号:' + idCard) BeforeParamCom().setLearn((('CStudent', 'mobile'), ), mobile) BeforeParamCom().setLearn((('CStudent', 'idCard'), ), idCard) values = (str(unvsid), str(pfsnId), str(taId), str(feeList), str(scholarship), str(recruitType), str(grade), str(pfsnLevel), str(mobile), str(idCard)) keys = (('data', 'unvsId'), ('data', 'pfsnid'), ('data', 'taId'), ('data', 'feeList'), ('data', 'scholarship'), ('data', 'recruitType'), ('data', 'grade'), ('data', 'pfsnLevel'), ('data', 'mobile'), ('data', 'idCard')) case = TestCaseAssembly().setAipParam('CrecruitAdd', values, keys) data = MultipartEncoder(fields=case[3]) DataSource().setHearder(data.content_type) response = YzApi().lapi(method=case[0], headers=DataSource().getHearder("regiester"), urls=case[2], data=data) '''断言''' self.assertTrue(MyAssert().assertchar(response.text, ['true', '00']), True)
def test_b_sPfsnByTransaction(self): '''成教学员新生信息修改申请随机获取专新业id''' intFile = YamlParser('StudentInfo') extFile = YamlParser('LearnInfo') ext1 = intFile.getYamlParms(('CJ', 'level')) BeforeParamCom().setLearn((('CStudent', 'npfsnLevel'), ), ext1) ext2 = intFile.getYamlParms(('CJ', 'grade')) ext3 = intFile.getYamlParms(('CJ', 'scholarships')) sId = extFile.getYamlParms(('CStudent', 'sId')) case = TestCaseAssembly().setAipParam( 'sPfsnByTransaction', (ext1, ext2, ext3, sId), (('data', 'ext1'), ('data', 'ext2'), ('data', 'ext3'), ('data', 'sId'))) response = YzApi().lapi(method=case[0], headers=case[1], urls=case[2], data=case[3]) '''断言''' self.assertTrue(MyAssert().assertchar(response.text, ['true', '00']), True) '''提取参数pfsnId''' AfterParamCom().saveParam(response.text, 'sPfsnByTransaction', ('CStudent', 'newPfsnId'))