Commit ca728f30 authored by 刘琴's avatar 刘琴

Merge branch 'liuqin_Q1' into 'master'

新增课程接口用例0628 See merge request !9
parents c2ed792c d0b0a439
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
<content url="file://$MODULE_DIR$"> <content url="file://$MODULE_DIR$">
<excludeFolder url="file://$MODULE_DIR$/venv" /> <excludeFolder url="file://$MODULE_DIR$/venv" />
</content> </content>
<orderEntry type="inheritedJdk" /> <orderEntry type="jdk" jdkName="Python 3.7" jdkType="Python SDK" />
<orderEntry type="sourceFolder" forTests="false" /> <orderEntry type="sourceFolder" forTests="false" />
</component> </component>
<component name="PyDocumentationSettings"> <component name="PyDocumentationSettings">
......
...@@ -62,7 +62,7 @@ class RunTest: ...@@ -62,7 +62,7 @@ class RunTest:
if __name__ == '__main__': if __name__ == '__main__':
case_path_list = [ case_path_list = [
"./script/ji_yun_ying_pc/service_education_liuqin/courses_liuqin/test_case_course.py::TestCourse::test_create_course_with_all_condition_success", "./script/ji_yun_ying_pc/service_education_liuqin/courses_liuqin/test_case_course.py::TestCourse::test_cope_course_success",
# "./script/ding_ding_jdata/person_time/test_person_time.py::TestsPersonTimeDetail::test_detail_page_search_date", # "./script/ding_ding_jdata/person_time/test_person_time.py::TestsPersonTimeDetail::test_detail_page_search_date",
# "./script/ding_ding_jdata/person_time/test_person_time.py::TestsPersonTimeDetail::test_detail_page_search_target", # "./script/ding_ding_jdata/person_time/test_person_time.py::TestsPersonTimeDetail::test_detail_page_search_target",
# "./script/ding_ding_jdata/person_time/test_person_time.py::TestsPersonTimeDetail::test_detail_page_search_subject", # "./script/ding_ding_jdata/person_time/test_person_time.py::TestsPersonTimeDetail::test_detail_page_search_subject",
......
class CreateCourseGlobalData():
"""
创建课程的公共参数
area: 创建课程的大区
schoolArea: 创建课程的校区
"""
area = 2382 # 成都一区
schoolArea = 2371 # 光华校区
\ No newline at end of file
import random import random
from decimal import Decimal from decimal import Decimal
from script.ji_yun_ying_pc.service_education_liuqin.Common.global_data import CreateCourseGlobalData
from script.ji_yun_ying_pc.service_education_liuqin.Common.helpler import get_now_time from script.ji_yun_ying_pc.service_education_liuqin.Common.helpler import get_now_time
class Add_My_New_Clue_isNotTerm(): class Add_My_New_Course_isNotTerm():
# 新增课程data,按课时收费 # 新增课程data,按课时收费
area = 2382 area = CreateCourseGlobalData.area
schoolArea = 2371 schoolArea = CreateCourseGlobalData.schoolArea
subject = ("数学", "语文", "英语", "物理", "化学") subject = ("数学", "语文", "英语", "物理", "化学")
classType = ( classType = (
"极趣班", "极思班", "极智班", "极客班", "极客A班", "极客蓝队班", "五四极趣班", "五四极思班", "五四极智班", "新生", "人教班", "八人精品", "定制班", "五四极客班") "极趣班", "极思班", "极智班", "极客班", "极客A班", "极客蓝队班", "五四极趣班", "五四极思班", "五四极智班", "新生", "人教班", "八人精品", "定制班", "五四极客班")
...@@ -21,9 +22,10 @@ class Add_My_New_Clue_isNotTerm(): ...@@ -21,9 +22,10 @@ class Add_My_New_Clue_isNotTerm():
courseType="常规班课", courseType="常规班课",
courseNumber="2", normalPrice="15", coursePrice="15", courseStatus="1", teachForm="offline", courseNumber="2", normalPrice="15", coursePrice="15", courseStatus="1", teachForm="offline",
courseDesc="", priceType=1, isTerm=False, perPeriodDuration=1, isNormal=1, courseDesc="", priceType=1, isTerm=False, perPeriodDuration=1, isNormal=1,
schools=[{"area": area, "schoolArea": schoolArea}], cContent=[] schools=None, cContent=[]
): ):
if schools is None:
schools = [{"area": Add_My_New_Course_isNotTerm.area, "schoolArea": Add_My_New_Course_isNotTerm.schoolArea}]
courseName = "【面授】{}{}{}{}[lq]{}".format(term, grade, subject, classType, get_now_time()) courseName = "【面授】{}{}{}{}[lq]{}".format(term, grade, subject, classType, get_now_time())
self.init_course_data = [ self.init_course_data = [
{"courseName": courseName, {"courseName": courseName,
...@@ -51,10 +53,10 @@ class Add_My_New_Clue_isNotTerm(): ...@@ -51,10 +53,10 @@ class Add_My_New_Clue_isNotTerm():
"cContent": cContent}] "cContent": cContent}]
class Add_My_New_Clue_isTerm(): class Add_My_New_Course_isTerm():
# 新增课程data,按期收费 # 新增课程data,按期收费
area = 2382 area = CreateCourseGlobalData.area
schoolArea = 2371 schoolArea = CreateCourseGlobalData.schoolArea
subject = ("数学", "语文", "英语", "物理", "化学") subject = ("数学", "语文", "英语", "物理", "化学")
classType = ( classType = (
"极趣班", "极思班", "极智班", "极客班", "极客A班", "极客蓝队班", "五四极趣班", "五四极思班", "五四极智班", "新生", "人教班", "八人精品", "定制班", "五四极客班") "极趣班", "极思班", "极智班", "极客班", "极客A班", "极客蓝队班", "五四极趣班", "五四极思班", "五四极智班", "新生", "人教班", "八人精品", "定制班", "五四极客班")
...@@ -66,8 +68,10 @@ class Add_My_New_Clue_isTerm(): ...@@ -66,8 +68,10 @@ class Add_My_New_Clue_isTerm():
courseType="常规班课", courseType="常规班课",
courseNumber="3", normalPrice="100", courseStatus="1", teachForm="offline", totalPrice="44", courseNumber="3", normalPrice="100", courseStatus="1", teachForm="offline", totalPrice="44",
courseDesc="", priceType=2, perPeriodDuration=1, isNormal=1, courseDesc="", priceType=2, perPeriodDuration=1, isNormal=1,
schools=[{"area": area, "schoolArea": schoolArea}], cContent=[] schools=None, cContent=[]
): ):
if schools is None:
schools = [{"area": Add_My_New_Course_isTerm.area, "schoolArea": Add_My_New_Course_isTerm.schoolArea}]
courseName = "【面授】{}{}{}{}[lq按期]{}".format(term, grade, subject, classType, get_now_time()) courseName = "【面授】{}{}{}{}[lq按期]{}".format(term, grade, subject, classType, get_now_time())
self.init_course_data = [ self.init_course_data = [
{"courseName": courseName, {"courseName": courseName,
...@@ -94,6 +98,245 @@ class Add_My_New_Clue_isTerm(): ...@@ -94,6 +98,245 @@ class Add_My_New_Clue_isTerm():
"cContent": cContent}] "cContent": cContent}]
class Add_My_New_Course_isNotTerm_sectionSetting():
# 新增课程data,按课时收费--分段
area = CreateCourseGlobalData.area
schoolArea = CreateCourseGlobalData.schoolArea
subject = ("数学", "语文", "英语", "物理", "化学")
classType = (
"极趣班", "极思班", "极智班", "极客班", "极客A班", "极客蓝队班", "五四极趣班", "五四极思班", "五四极智班", "新生", "人教班", "八人精品", "定制班", "五四极客班")
grade_list = ['零年级', '一年级', '二年级', '三年级', '四年级', '五年级', '六年级', '七年级', '八年级', '九年级', '高一', '高二', '高三']
# "courseStatus": "2" 停用 "1" 启用
# "isNormal": 2 低价课程 1 正价课程
def __init__(self, courseName="",
term="暑", subject=random.sample(subject, 1)[0], productType="", year=2021,
classType=random.sample(classType, 1)[0], grade=random.sample(grade_list, 1)[0], coursePeriod="4",
courseType="常规班课",
courseNumber="2", normalPrice="23", coursePrice="20", courseStatus="1", teachForm="offline",
courseDesc="", priceType=1, isTerm=False, perPeriodDuration=1, isNormal=1,
sectionSetting=1, uphalfCoursePeriod="2", downhalfCoursePeriod=3,
schools=None, cContent=[]
):
if schools is None:
schools = [{"area": Add_My_New_Course_isNotTerm_sectionSetting.area,
"schoolArea": Add_My_New_Course_isNotTerm_sectionSetting.schoolArea}]
courseName = "【面授】{}{}{}{}[lq分段]{}".format(term, grade, subject, classType, get_now_time())
self.init_course_data = [
{"courseName": courseName,
"term": term,
"subject": subject,
"productType": productType,
"year": year,
"classType": classType,
"grade": grade,
"coursePeriod": coursePeriod,
"courseType": courseType,
"courseNumber": courseNumber,
"normalPrice": normalPrice,
"coursePrice": coursePrice,
"courseStatus": courseStatus,
"teachForm": teachForm,
"courseDesc": courseDesc,
"priceType": priceType,
"isTerm": isTerm,
"perPeriodDuration": perPeriodDuration,
"isNormal": isNormal,
"sectionSetting": sectionSetting,
"uphalfCoursePeriod": uphalfCoursePeriod,
"downhalfCoursePeriod": downhalfCoursePeriod,
"totalPrice": float(coursePeriod) * float(coursePrice),
"registerGrade": grade,
"schools": schools,
"cContent": cContent}]
class Add_My_New_Vip_Course():
# 新增精品课程data,按课时收费
area = CreateCourseGlobalData.area
schoolArea = CreateCourseGlobalData.schoolArea
subject = ("数学", "语文", "英语", "物理", "化学")
classType = ('一对一定制班', '一对三定制班', '一对八定制班', '一对六定制班')
grade_list = ['零年级', '一年级', '二年级', '三年级', '四年级', '五年级', '六年级', '七年级', '八年级', '九年级', '高一', '高二', '高三']
# "courseStatus": "2" 停用 "1" 启用
# "isNormal": 2 低价课程 1 正价课程
def __init__(self, courseName="",
term="暑", subject=random.sample(subject, 1)[0], productType="", year=2021,
classType=random.sample(classType, 1)[0], grade=random.sample(grade_list, 1)[0],
courseType="精品定制课",
normalPrice="23", coursePrice="20", courseStatus="1", teachForm="offline",
courseDesc="", priceType=1, perPeriodDuration=10, totalPrice=0, schools=None, cContent=[]
):
if schools is None:
schools = [{"area": Add_My_New_Vip_Course.area, "schoolArea": Add_My_New_Vip_Course.schoolArea}]
courseName = "【面授】{}{}{}{}[lq精品]{}".format(term, grade, subject, classType, get_now_time())
self.init_course_data = [
{"courseName": courseName,
"term": term,
"subject": subject,
"productType": productType,
"year": year,
"classType": classType,
"grade": grade,
"courseType": courseType,
"normalPrice": normalPrice,
"coursePrice": coursePrice,
"courseStatus": courseStatus,
"teachForm": teachForm,
"courseDesc": courseDesc,
"priceType": priceType,
"perPeriodDuration": perPeriodDuration,
"totalPrice": totalPrice,
"schools": schools,
"cContent": cContent}]
class Add_My_jiXun_Course():
# 新增集训课程data,按课时收费
area = CreateCourseGlobalData.area
schoolArea = CreateCourseGlobalData.schoolArea
subject = ("数学", "语文", "英语", "物理", "化学")
classType = ('五年级选修课班', '五四制班', '知识体系复习课班')
grade_list = ['零年级', '一年级', '二年级', '三年级', '四年级', '五年级', '六年级', '七年级', '八年级', '九年级', '高一', '高二', '高三']
# "courseStatus": "2" 停用 "1" 启用
# "isNormal": 2 低价课程 1 正价课程
def __init__(self, courseName="",
term="暑", subject=random.sample(subject, 1)[0], productType="", year=2021,
classType=random.sample(classType, 1)[0], grade=random.sample(grade_list, 1)[0], coursePeriod="8",
courseType="集训班课",
courseNumber="4", normalPrice="100", coursePrice="100", courseStatus="1", teachForm="offline",
courseDesc="", priceType=1, isTerm=False, perPeriodDuration=3, isNormal=1,
schools=None, cContent=[]
):
if schools is None:
schools = [{"area": Add_My_jiXun_Course.area, "schoolArea": Add_My_jiXun_Course.schoolArea}]
courseName = "【面授】{}{}{}{}[lq集训]{}".format(term, grade, subject, classType, get_now_time())
self.init_course_data = [
{"courseName": courseName,
"term": term,
"subject": subject,
"productType": productType,
"year": year,
"classType": classType,
"grade": grade,
"coursePeriod": coursePeriod,
"courseType": courseType,
"courseNumber": courseNumber,
"normalPrice": normalPrice,
"coursePrice": coursePrice,
"courseStatus": courseStatus,
"teachForm": teachForm,
"courseDesc": courseDesc,
"priceType": priceType,
"isTerm": isTerm,
"perPeriodDuration": perPeriodDuration,
"isNormal": isNormal,
"totalPrice": float(coursePeriod) * float(coursePrice),
"registerGrade": grade,
"schools": schools,
"cContent": cContent}
]
class Add_My_zuanTi_Course():
# 新增专题课程data,按课时收费
area = CreateCourseGlobalData.area
schoolArea = CreateCourseGlobalData.schoolArea
subject = ("数学", "语文", "英语", "物理", "化学")
classType = ('专题')
grade_list = ['零年级', '一年级', '二年级', '三年级', '四年级', '五年级', '六年级', '七年级', '八年级', '九年级', '高一', '高二', '高三']
# "courseStatus": "2" 停用 "1" 启用
# "isNormal": 2 低价课程 1 正价课程
def __init__(self, courseName="",
term="暑", subject=random.sample(subject, 1)[0], productType="", year=2021,
classType=random.sample(classType, 1)[0], grade=random.sample(grade_list, 1)[0], coursePeriod="8",
courseType="专题班课",
courseNumber="4", normalPrice="100", coursePrice="100", courseStatus="1", teachForm="offline",
courseDesc="", priceType=1, isTerm=False, perPeriodDuration=3, isNormal=1,
schools=None, cContent=[]
):
if schools is None:
schools = [{"area": Add_My_zuanTi_Course.area, "schoolArea": Add_My_zuanTi_Course.schoolArea}]
courseName = "【面授】{}{}{}{}[lq专题]{}".format(term, grade, subject, classType, get_now_time())
self.init_course_data = [
{"courseName": courseName,
"term": term,
"subject": subject,
"productType": productType,
"year": year,
"classType": classType,
"grade": grade,
"coursePeriod": coursePeriod,
"courseType": courseType,
"courseNumber": courseNumber,
"normalPrice": normalPrice,
"coursePrice": coursePrice,
"courseStatus": courseStatus,
"teachForm": teachForm,
"courseDesc": courseDesc,
"priceType": priceType,
"isTerm": isTerm,
"perPeriodDuration": perPeriodDuration,
"isNormal": isNormal,
"totalPrice": float(coursePeriod) * float(coursePrice),
"registerGrade": grade,
"schools": schools,
"cContent": cContent}
]
class Add_My_fuWu_Course():
# 新增服务课程data,按课时收费
area = CreateCourseGlobalData.area
schoolArea = CreateCourseGlobalData.schoolArea
subject = ("数学", "语文", "英语", "物理", "化学")
classType = ('公开课', '辅导课', '讲座')
grade_list = ['零年级', '一年级', '二年级', '三年级', '四年级', '五年级', '六年级', '七年级', '八年级', '九年级', '高一', '高二', '高三']
# "courseStatus": "2" 停用 "1" 启用
# "isNormal": 2 低价课程 1 正价课程
def __init__(self, courseName="",
term="暑", subject=random.sample(subject, 1)[0], productType="", year=2021,
classType=random.sample(classType, 1)[0], grade=random.sample(grade_list, 1)[0], coursePeriod="8",
courseType="服务班课",
courseNumber="4", normalPrice="100", coursePrice="100", courseStatus="1", teachForm="offline",
courseDesc="", priceType=1, isTerm=False, perPeriodDuration=3, isNormal=1,
schools=None, cContent=[]
):
if schools is None:
schools = [{"area": Add_My_fuWu_Course.area, "schoolArea": Add_My_fuWu_Course.schoolArea}]
courseName = "【面授】{}{}{}{}[lq服务]{}".format(term, grade, subject, classType, get_now_time())
self.init_course_data = [
{"courseName": courseName,
"term": term,
"subject": subject,
"productType": productType,
"year": year,
"classType": classType,
"grade": grade,
"coursePeriod": coursePeriod,
"courseType": courseType,
"courseNumber": courseNumber,
"normalPrice": normalPrice,
"coursePrice": coursePrice,
"courseStatus": courseStatus,
"teachForm": teachForm,
"courseDesc": courseDesc,
"priceType": priceType,
"isTerm": isTerm,
"perPeriodDuration": perPeriodDuration,
"isNormal": isNormal,
"totalPrice": float(coursePeriod) * float(coursePrice),
"registerGrade": grade,
"schools": schools,
"cContent": cContent}
]
if __name__ == '__main__': if __name__ == '__main__':
totalPrice = Decimal("44") totalPrice = Decimal("44")
coursePeriod = Decimal("3") coursePeriod = Decimal("3")
......
from pytest_assume.plugin import assume from pytest_assume.plugin import assume
from script.base_api import education_courses_add_post, education_courses_query_post from script.base_api import education_courses_add_post, education_courses_query_post, education_courses_queryByIds_post
from script.default_header import jyy_header from script.default_header import jyy_header
from script.ji_yun_ying_pc.service_education_liuqin.courses_liuqin.Course_Data import Add_My_New_Clue_isNotTerm, \ from script.ji_yun_ying_pc.service_education_liuqin.Common.global_data import CreateCourseGlobalData
Add_My_New_Clue_isTerm from script.ji_yun_ying_pc.service_education_liuqin.courses_liuqin.Course_Data import Add_My_New_Course_isNotTerm, \
Add_My_New_Course_isTerm, Add_My_New_Course_isNotTerm_sectionSetting, Add_My_New_Vip_Course, Add_My_jiXun_Course, \
Add_My_zuanTi_Course, Add_My_fuWu_Course
class TestCourse(): class TestCourse():
...@@ -15,7 +17,7 @@ class TestCourse(): ...@@ -15,7 +17,7 @@ class TestCourse():
# 验证新增内容课后自动成为商品 # 验证新增内容课后自动成为商品
# 验证新增【不分段常规班课课程】---所有项 # 验证新增【不分段常规班课课程】---所有项
def test_create_course_with_all_condition_success(self): def test_create_course_with_all_condition_success(self):
json_data = Add_My_New_Clue_isNotTerm().init_course_data json_data = Add_My_New_Course_isNotTerm().init_course_data
# 获取新建课程的参数 # 获取新建课程的参数
courseName = json_data[0]['courseName'], courseName = json_data[0]['courseName'],
term = json_data[0]['term'], term = json_data[0]['term'],
...@@ -24,7 +26,7 @@ class TestCourse(): ...@@ -24,7 +26,7 @@ class TestCourse():
year = json_data[0]['year'], year = json_data[0]['year'],
classType = json_data[0]['classType'], classType = json_data[0]['classType'],
grade = json_data[0]['grade'], grade = json_data[0]['grade'],
registerGrade= json_data[0]['registerGrade'], registerGrade = json_data[0]['registerGrade'],
coursePeriod = json_data[0]['coursePeriod'], coursePeriod = json_data[0]['coursePeriod'],
courseType = json_data[0]['courseType'], courseType = json_data[0]['courseType'],
courseNumber = json_data[0]['courseNumber'], courseNumber = json_data[0]['courseNumber'],
...@@ -33,7 +35,7 @@ class TestCourse(): ...@@ -33,7 +35,7 @@ class TestCourse():
totalPrice = json_data[0]['totalPrice'], totalPrice = json_data[0]['totalPrice'],
courseStatus = json_data[0]['courseStatus'], courseStatus = json_data[0]['courseStatus'],
teachForm = json_data[0]['teachForm'], teachForm = json_data[0]['teachForm'],
courseDesc =json_data[0]['courseDesc'], courseDesc = json_data[0]['courseDesc'],
priceType = json_data[0]['priceType'], priceType = json_data[0]['priceType'],
isTerm = json_data[0]['isTerm'], isTerm = json_data[0]['isTerm'],
perPeriodDuration = json_data[0]['perPeriodDuration'], perPeriodDuration = json_data[0]['perPeriodDuration'],
...@@ -43,8 +45,10 @@ class TestCourse(): ...@@ -43,8 +45,10 @@ class TestCourse():
# 新增课程 # 新增课程
try: try:
add_res = education_courses_add_post(body=json_data, header=jyy_header) add_res = education_courses_add_post(body=json_data, header=jyy_header)
with assume: assert add_res['code'] == 0 with assume:
with assume: assert add_res['msg'] == '成功' assert add_res['code'] == 0
with assume:
assert add_res['msg'] == '成功'
except: except:
print('新建课程失败') print('新建课程失败')
raise raise
...@@ -53,38 +57,59 @@ class TestCourse(): ...@@ -53,38 +57,59 @@ class TestCourse():
schoolAreas = schools[0][0] schoolAreas = schools[0][0]
schoolAreas = schoolAreas['schoolArea'] schoolAreas = schoolAreas['schoolArea']
print(schoolAreas) print(schoolAreas)
query_data = {"type":"not-click","schoolAreas":[schoolAreas]} query_data = {"type": "not-click", "schoolAreas": [schoolAreas]}
params = {'pageNum':1,'pageSize':10} params = {'pageNum': 1, 'pageSize': 10}
query_res = education_courses_query_post(params=params,body=query_data, header=jyy_header) query_res = education_courses_query_post(params=params, body=query_data, header=jyy_header)
res_first_course_data = query_res['data']['content'][0] res_first_course_data = query_res['data']['content'][0]
with assume:assert query_res['code'] == 0 with assume:
with assume:assert query_res['msg'] == '成功' assert query_res['code'] == 0
with assume:assert res_first_course_data['classType'] == classType[0] with assume:
with assume:assert res_first_course_data['courseDesc'] ==courseDesc[0] assert query_res['msg'] == '成功'
with assume:assert res_first_course_data['courseName'] == courseName[0] with assume:
with assume:assert res_first_course_data['courseNumber'] ==int(courseNumber[0]) assert res_first_course_data['classType'] == classType[0]
with assume:assert res_first_course_data['coursePeriod'] == float(coursePeriod[0]) with assume:
with assume:assert res_first_course_data['coursePrice'] == float(coursePrice[0]) assert res_first_course_data['courseDesc'] == courseDesc[0]
with assume:assert res_first_course_data['courseType'] == courseType[0] with assume:
with assume:assert res_first_course_data['grade'] == grade[0] assert res_first_course_data['courseName'] == courseName[0]
with assume:assert res_first_course_data['isNormal'] == isNormal[0] with assume:
with assume:assert res_first_course_data['normalPrice'] == float(normalPrice[0]) assert res_first_course_data['courseNumber'] == int(courseNumber[0])
with assume:assert res_first_course_data['perPeriodDuration'] == perPeriodDuration[0] with assume:
with assume:assert res_first_course_data['priceType'] == priceType[0] assert res_first_course_data['coursePeriod'] == float(coursePeriod[0])
with assume:assert res_first_course_data['productType'] == productType[0] with assume:
with assume:assert res_first_course_data['registerGrade'] == registerGrade[0] assert res_first_course_data['coursePrice'] == float(coursePrice[0])
with assume:assert res_first_course_data['subject'] == subject[0] with assume:
with assume:assert res_first_course_data['teachForm'] == teachForm[0] assert res_first_course_data['courseType'] == courseType[0]
with assume:assert res_first_course_data['term'] == term[0] with assume:
with assume:assert res_first_course_data['totalPrice'] == totalPrice[0] assert res_first_course_data['grade'] == grade[0]
with assume:assert res_first_course_data['year'] == year[0] with assume:
assert res_first_course_data['isNormal'] == isNormal[0]
with assume:
assert res_first_course_data['normalPrice'] == float(normalPrice[0])
with assume:
assert res_first_course_data['perPeriodDuration'] == perPeriodDuration[0]
with assume:
assert res_first_course_data['priceType'] == priceType[0]
with assume:
assert res_first_course_data['productType'] == productType[0]
with assume:
assert res_first_course_data['registerGrade'] == registerGrade[0]
with assume:
assert res_first_course_data['subject'] == subject[0]
with assume:
assert res_first_course_data['teachForm'] == teachForm[0]
with assume:
assert res_first_course_data['term'] == term[0]
with assume:
assert res_first_course_data['totalPrice'] == totalPrice[0]
with assume:
assert res_first_course_data['year'] == year[0]
except: except:
print('查询课程失败') print('查询课程失败')
raise raise
# 验证新增【不分段常规班课课程】---按期收费 # 验证新增【不分段常规班课课程】---按期收费
def test_create_course_by_term_success(self): def test_create_course_by_term_success(self):
json_data =Add_My_New_Clue_isTerm().init_course_data json_data = Add_My_New_Course_isTerm().init_course_data
# 获取新建课程的参数 # 获取新建课程的参数
courseName = json_data[0]['courseName'], courseName = json_data[0]['courseName'],
...@@ -111,8 +136,10 @@ class TestCourse(): ...@@ -111,8 +136,10 @@ class TestCourse():
cContent = json_data[0]['cContent'] cContent = json_data[0]['cContent']
try: try:
add_res = education_courses_add_post(body=json_data, header=jyy_header) add_res = education_courses_add_post(body=json_data, header=jyy_header)
with assume: assert add_res['code'] == 0 with assume:
with assume: assert add_res['msg'] == '成功' assert add_res['code'] == 0
with assume:
assert add_res['msg'] == '成功'
except: except:
print('新建课程失败') print('新建课程失败')
raise raise
...@@ -121,50 +148,73 @@ class TestCourse(): ...@@ -121,50 +148,73 @@ class TestCourse():
schoolAreas = schools[0][0] schoolAreas = schools[0][0]
schoolAreas = schoolAreas['schoolArea'] schoolAreas = schoolAreas['schoolArea']
print(schoolAreas) print(schoolAreas)
query_data = {"type":"not-click","schoolAreas":[schoolAreas]} query_data = {"type": "not-click", "schoolAreas": [schoolAreas]}
params = {'pageNum':1,'pageSize':10} params = {'pageNum': 1, 'pageSize': 10}
query_res = education_courses_query_post(params=params,body=query_data, header=jyy_header) query_res = education_courses_query_post(params=params, body=query_data, header=jyy_header)
res_first_course_data = query_res['data']['content'][0] res_first_course_data = query_res['data']['content'][0]
with assume:assert query_res['code'] == 0 with assume:
with assume:assert query_res['msg'] == '成功' assert query_res['code'] == 0
with assume:assert res_first_course_data['classType'] == classType[0] with assume:
with assume:assert res_first_course_data['courseDesc'] ==courseDesc[0] assert query_res['msg'] == '成功'
with assume:assert res_first_course_data['courseName'] == courseName[0] with assume:
with assume:assert res_first_course_data['courseNumber'] ==int(courseNumber[0]) assert res_first_course_data['classType'] == classType[0]
with assume:assert res_first_course_data['coursePeriod'] == float(coursePeriod[0]) with assume:
with assume:assert res_first_course_data['coursePrice'] == float(coursePrice[0]) assert res_first_course_data['courseDesc'] == courseDesc[0]
with assume:assert res_first_course_data['courseType'] == courseType[0] with assume:
with assume:assert res_first_course_data['grade'] == grade[0] assert res_first_course_data['courseName'] == courseName[0]
with assume:assert res_first_course_data['isNormal'] == isNormal[0] with assume:
with assume:assert res_first_course_data['normalPrice'] == float(normalPrice[0]) assert res_first_course_data['courseNumber'] == int(courseNumber[0])
with assume:assert res_first_course_data['perPeriodDuration'] == perPeriodDuration[0] with assume:
with assume:assert res_first_course_data['priceType'] == priceType[0] assert res_first_course_data['coursePeriod'] == float(coursePeriod[0])
with assume:assert res_first_course_data['productType'] == productType[0] with assume:
with assume:assert res_first_course_data['registerGrade'] == registerGrade[0] assert res_first_course_data['coursePrice'] == float(coursePrice[0])
with assume:assert res_first_course_data['subject'] == subject[0] with assume:
with assume:assert res_first_course_data['teachForm'] == teachForm[0] assert res_first_course_data['courseType'] == courseType[0]
with assume:assert res_first_course_data['term'] == term[0] with assume:
with assume:assert res_first_course_data['totalPrice'] == float(totalPrice[0]) assert res_first_course_data['grade'] == grade[0]
with assume:assert res_first_course_data['year'] == year[0] with assume:
assert res_first_course_data['isNormal'] == isNormal[0]
with assume:
assert res_first_course_data['normalPrice'] == float(normalPrice[0])
with assume:
assert res_first_course_data['perPeriodDuration'] == perPeriodDuration[0]
with assume:
assert res_first_course_data['priceType'] == priceType[0]
with assume:
assert res_first_course_data['productType'] == productType[0]
with assume:
assert res_first_course_data['registerGrade'] == registerGrade[0]
with assume:
assert res_first_course_data['subject'] == subject[0]
with assume:
assert res_first_course_data['teachForm'] == teachForm[0]
with assume:
assert res_first_course_data['term'] == term[0]
with assume:
assert res_first_course_data['totalPrice'] == float(totalPrice[0])
with assume:
assert res_first_course_data['year'] == year[0]
except: except:
print('查询课程失败') print('查询课程失败')
raise raise
# 验证新增【不分段常规班课课程】---标准价>=现价的限制 # 验证新增【不分段常规班课课程】---标准价>=现价的限制
def test_create_course_with_coursePrice_bigger_than_normalPrice_failure(self): def test_create_course_with_coursePrice_bigger_than_normalPrice_failure(self):
json_data = Add_My_New_Clue_isNotTerm(normalPrice="15",coursePrice='16').init_course_data json_data = Add_My_New_Course_isNotTerm(normalPrice="15", coursePrice='16').init_course_data
try: try:
add_res = education_courses_add_post(body=json_data, header=jyy_header) add_res = education_courses_add_post(body=json_data, header=jyy_header)
with assume: assert add_res['code'] == -1 with assume:
with assume: assert add_res['msg'] == '失败' assert add_res['code'] == -1
with assume:
assert add_res['msg'] == '失败'
except: except:
print('新建课程失败') print('新建课程失败')
raise raise
# 验证新增【不分段常规班课课程】---现价*总课时!=总价----fail # 验证新增【不分段常规班课课程】---现价*总课时!=总价----fail
def test_create_course_with_totalPrice_bigger_failure(self): def test_create_course_with_totalPrice_bigger_failure(self):
json_data = Add_My_New_Clue_isNotTerm(coursePrice="15",coursePeriod="4").init_course_data json_data = Add_My_New_Course_isNotTerm(coursePrice="15", coursePeriod="4").init_course_data
json_data[0]['totalPrice']= "200" json_data[0]['totalPrice'] = "200"
try: try:
add_res = education_courses_add_post(body=json_data, header=jyy_header) add_res = education_courses_add_post(body=json_data, header=jyy_header)
...@@ -178,7 +228,7 @@ class TestCourse(): ...@@ -178,7 +228,7 @@ class TestCourse():
# 验证新增【不分段常规班课课程】---价格为负数 # 验证新增【不分段常规班课课程】---价格为负数
def test_create_course_with_negative_price_failure(self): def test_create_course_with_negative_price_failure(self):
json_data = Add_My_New_Clue_isNotTerm(coursePrice="-20").init_course_data json_data = Add_My_New_Course_isNotTerm(coursePrice="-20").init_course_data
print(json_data) print(json_data)
try: try:
...@@ -193,7 +243,7 @@ class TestCourse(): ...@@ -193,7 +243,7 @@ class TestCourse():
# 验证新增【不分段常规班课课程】---网报年级与课程年级不匹配---fail # 验证新增【不分段常规班课课程】---网报年级与课程年级不匹配---fail
def test_create_course_with_wrong_registerGrade_failure(self): def test_create_course_with_wrong_registerGrade_failure(self):
json_data = Add_My_New_Clue_isNotTerm(grade="三年级").init_course_data json_data = Add_My_New_Course_isNotTerm(grade="三年级").init_course_data
json_data[0]['registerGrade'] = "六年级" json_data[0]['registerGrade'] = "六年级"
print(json_data) print(json_data)
...@@ -209,7 +259,7 @@ class TestCourse(): ...@@ -209,7 +259,7 @@ class TestCourse():
# 验证新增【不分段常规班课课程】---每课时分钟数设置为负数---fail # 验证新增【不分段常规班课课程】---每课时分钟数设置为负数---fail
def test_create_course_with_negative_coursePeriod_failure(self): def test_create_course_with_negative_coursePeriod_failure(self):
json_data = Add_My_New_Clue_isNotTerm(coursePeriod="-4",courseNumber="-2").init_course_data json_data = Add_My_New_Course_isNotTerm(coursePeriod="-4", courseNumber="-2").init_course_data
print(json_data) print(json_data)
try: try:
...@@ -221,9 +271,10 @@ class TestCourse(): ...@@ -221,9 +271,10 @@ class TestCourse():
except: except:
print('新建课程失败') print('新建课程失败')
raise raise
# 验证新增【不分段常规班课课程】---计划排课数与总课时限制 # 验证新增【不分段常规班课课程】---计划排课数与总课时限制
def test_create_course_with_wrong_courseNumber_failure(self): def test_create_course_with_wrong_courseNumber_failure(self):
json_data = Add_My_New_Clue_isNotTerm(coursePeriod="4", courseNumber="1.3").init_course_data json_data = Add_My_New_Course_isNotTerm(coursePeriod="4", courseNumber="1.3").init_course_data
print(json_data) print(json_data)
try: try:
...@@ -235,9 +286,10 @@ class TestCourse(): ...@@ -235,9 +286,10 @@ class TestCourse():
except: except:
print('新建课程失败') print('新建课程失败')
raise raise
# 验证新增【不分段常规班课课程】---低价课程 # 验证新增【不分段常规班课课程】---低价课程
def test_create_course_with_low_price(self): def test_create_course_with_low_price(self):
json_data = Add_My_New_Clue_isNotTerm(isNormal=2).init_course_data json_data = Add_My_New_Course_isNotTerm(isNormal=2).init_course_data
isNormal = json_data[0]['isNormal'] isNormal = json_data[0]['isNormal']
schools = json_data[0]['schools'] schools = json_data[0]['schools']
print(schools) print(schools)
...@@ -255,9 +307,9 @@ class TestCourse(): ...@@ -255,9 +307,9 @@ class TestCourse():
try: try:
schoolAreas = schools[0] schoolAreas = schools[0]
schoolAreas = schoolAreas['schoolArea'] schoolAreas = schoolAreas['schoolArea']
query_data = {"type":"not-click","schoolAreas":[schoolAreas]} query_data = {"type": "not-click", "schoolAreas": [schoolAreas]}
params = {'pageNum':1,'pageSize':10} params = {'pageNum': 1, 'pageSize': 10}
query_res = education_courses_query_post(params=params,body=query_data, header=jyy_header) query_res = education_courses_query_post(params=params, body=query_data, header=jyy_header)
res_first_course_data = query_res['data']['content'][0] res_first_course_data = query_res['data']['content'][0]
with assume: with assume:
assert add_res['code'] == 0 assert add_res['code'] == 0
...@@ -268,18 +320,787 @@ class TestCourse(): ...@@ -268,18 +320,787 @@ class TestCourse():
except: except:
print('查询课程失败') print('查询课程失败')
raise raise
# 验证新增【分段常规班课课程】---正价课程 # 验证新增【分段常规班课课程】---正价课程
def test_create_sectionSetting_course(self):
json_data = Add_My_New_Course_isNotTerm_sectionSetting().init_course_data
courseName = json_data[0]['courseName'],
term = json_data[0]['term'],
subject = json_data[0]['subject'],
productType = json_data[0]['productType'],
year = json_data[0]['year'],
classType = json_data[0]['classType'],
grade = json_data[0]['grade'],
registerGrade = json_data[0]['registerGrade'],
coursePeriod = json_data[0]['coursePeriod'],
courseType = json_data[0]['courseType'],
courseNumber = json_data[0]['courseNumber'],
normalPrice = json_data[0]['normalPrice'],
coursePrice = json_data[0]['coursePrice'],
totalPrice = json_data[0]['totalPrice'],
courseStatus = json_data[0]['courseStatus'],
teachForm = json_data[0]['teachForm'],
courseDesc = json_data[0]['courseDesc'],
priceType = json_data[0]['priceType'],
isTerm = json_data[0]['isTerm'],
perPeriodDuration = json_data[0]['perPeriodDuration'],
isNormal = json_data[0]['isNormal'],
schools = json_data[0]['schools'],
cContent = json_data[0]['cContent']
try:
add_res = education_courses_add_post(body=json_data, header=jyy_header)
with assume:
assert add_res['code'] == 0
with assume:
assert add_res['msg'] == '成功'
except:
print('新建课程失败')
raise
try:
schoolAreas = schools[0][0]
schoolAreas = schoolAreas['schoolArea']
print(schoolAreas)
query_data = {"type": "not-click", "schoolAreas": [schoolAreas]}
params = {'pageNum': 1, 'pageSize': 10}
query_res = education_courses_query_post(params=params, body=query_data, header=jyy_header)
res_first_course_data = query_res['data']['content'][0]
with assume:
assert query_res['code'] == 0
with assume:
assert query_res['msg'] == '成功'
with assume:
assert res_first_course_data['classType'] == classType[0]
with assume:
assert res_first_course_data['courseDesc'] == courseDesc[0]
with assume:
assert res_first_course_data['courseName'] == courseName[0]
with assume:
assert res_first_course_data['courseNumber'] == int(courseNumber[0])
with assume:
assert res_first_course_data['coursePeriod'] == float(coursePeriod[0])
with assume:
assert res_first_course_data['coursePrice'] == float(coursePrice[0])
with assume:
assert res_first_course_data['courseType'] == courseType[0]
with assume:
assert res_first_course_data['grade'] == grade[0]
with assume:
assert res_first_course_data['isNormal'] == isNormal[0]
with assume:
assert res_first_course_data['normalPrice'] == float(normalPrice[0])
with assume:
assert res_first_course_data['perPeriodDuration'] == perPeriodDuration[0]
with assume:
assert res_first_course_data['priceType'] == priceType[0]
with assume:
assert res_first_course_data['productType'] == productType[0]
with assume:
assert res_first_course_data['registerGrade'] == registerGrade[0]
with assume:
assert res_first_course_data['subject'] == subject[0]
with assume:
assert res_first_course_data['teachForm'] == teachForm[0]
with assume:
assert res_first_course_data['term'] == term[0]
with assume:
assert res_first_course_data['totalPrice'] == totalPrice[0]
with assume:
assert res_first_course_data['year'] == year[0]
except:
print('查询课程失败')
raise
# 验证新增【分段常规班课课程】---低价课程 # 验证新增【分段常规班课课程】---低价课程
def test_create_sectionSetting_course_with_low_price(self):
json_data = Add_My_New_Course_isNotTerm_sectionSetting(isNormal=2).init_course_data
isNormal = json_data[0]['isNormal']
schools = json_data[0]['schools']
print(schools)
try:
add_res = education_courses_add_post(body=json_data, header=jyy_header)
with assume:
assert add_res['code'] == 0
with assume:
assert add_res['msg'] == '成功'
except:
print('新建课程失败')
raise
try:
schoolAreas = schools[0]
schoolAreas = schoolAreas['schoolArea']
query_data = {"type": "not-click", "schoolAreas": [schoolAreas]}
params = {'pageNum': 1, 'pageSize': 10}
query_res = education_courses_query_post(params=params, body=query_data, header=jyy_header)
res_first_course_data = query_res['data']['content'][0]
with assume:
assert add_res['code'] == 0
with assume:
assert add_res['msg'] == '成功'
with assume:
assert res_first_course_data['isNormal'] == isNormal
except:
print('查询课程失败')
raise
# 验证新增【分段常规班课课程】---学期 传非法值 # 验证新增【分段常规班课课程】---学期 传非法值
def test_create_sectionSetting_course_with_wrong_term(self):
json_data = Add_My_New_Course_isNotTerm_sectionSetting(term='错误学期').init_course_data
try:
add_res = education_courses_add_post(body=json_data, header=jyy_header)
with assume:
assert add_res['code'] == -1
with assume:
assert add_res['msg'] == '失败'
except:
print('新建课程失败')
raise
# 验证新增【分段常规班课课程】---科目 传非法值 # 验证新增【分段常规班课课程】---科目 传非法值
def test_create_sectionSetting_course_with_wrong_subject(self):
json_data = Add_My_New_Course_isNotTerm_sectionSetting(subject='错误科目').init_course_data
try:
add_res = education_courses_add_post(body=json_data, header=jyy_header)
with assume:
assert add_res['code'] == -1
with assume:
assert add_res['msg'] == '失败'
except:
print('新建课程失败')
raise
# 验证新增【分段常规班课课程】---年级 传非法值 # 验证新增【分段常规班课课程】---年级 传非法值
def test_create_sectionSetting_course_with_wrong_grade(self):
json_data = Add_My_New_Course_isNotTerm_sectionSetting(grade='错误年级').init_course_data
try:
add_res = education_courses_add_post(body=json_data, header=jyy_header)
with assume:
assert add_res['code'] == -1
with assume:
assert add_res['msg'] == '失败'
except:
print('新建课程失败')
raise
# 验证新增【分段常规班课课程】---课型与班型不匹配 # 验证新增【分段常规班课课程】---课型与班型不匹配
def test_create_sectionSetting_course_with_wrong_classType(self):
json_data = Add_My_New_Course_isNotTerm_sectionSetting(classType='错误班型').init_course_data
try:
add_res = education_courses_add_post(body=json_data, header=jyy_header)
with assume:
assert add_res['code'] == -1
with assume:
assert add_res['msg'] == '失败'
except:
print('新建课程失败')
raise
# 验证新增【不分段常规班课课程】---停用 # 验证新增【不分段常规班课课程】---停用
def test_create_sectionSetting_course_with_disable(self):
json_data = Add_My_New_Course_isNotTerm_sectionSetting(courseStatus='2').init_course_data
courseName = json_data[0]['courseName'],
term = json_data[0]['term'],
subject = json_data[0]['subject'],
productType = json_data[0]['productType'],
year = json_data[0]['year'],
classType = json_data[0]['classType'],
grade = json_data[0]['grade'],
registerGrade = json_data[0]['registerGrade'],
coursePeriod = json_data[0]['coursePeriod'],
courseType = json_data[0]['courseType'],
courseNumber = json_data[0]['courseNumber'],
normalPrice = json_data[0]['normalPrice'],
coursePrice = json_data[0]['coursePrice'],
totalPrice = json_data[0]['totalPrice'],
courseStatus = json_data[0]['courseStatus'],
teachForm = json_data[0]['teachForm'],
courseDesc = json_data[0]['courseDesc'],
priceType = json_data[0]['priceType'],
isTerm = json_data[0]['isTerm'],
perPeriodDuration = json_data[0]['perPeriodDuration'],
isNormal = json_data[0]['isNormal'],
schools = json_data[0]['schools'],
cContent = json_data[0]['cContent']
try:
add_res = education_courses_add_post(body=json_data, header=jyy_header)
with assume:
assert add_res['code'] == 0
with assume:
assert add_res['msg'] == '成功'
except:
print('新建课程失败')
raise
try:
schoolAreas = schools[0][0]
schoolAreas = schoolAreas['schoolArea']
print(schoolAreas)
query_data = {"type": "not-click", "schoolAreas": [schoolAreas]}
params = {'pageNum': 1, 'pageSize': 10}
query_res = education_courses_query_post(params=params, body=query_data, header=jyy_header)
res_first_course_data = query_res['data']['content'][0]
with assume:
assert query_res['code'] == 0
with assume:
assert query_res['msg'] == '成功'
with assume:
assert res_first_course_data['classType'] == classType[0]
with assume:
assert res_first_course_data['courseDesc'] == courseDesc[0]
with assume:
assert res_first_course_data['courseName'] == courseName[0]
with assume:
assert res_first_course_data['courseNumber'] == int(courseNumber[0])
with assume:
assert res_first_course_data['coursePeriod'] == float(coursePeriod[0])
with assume:
assert res_first_course_data['coursePrice'] == float(coursePrice[0])
with assume:
assert res_first_course_data['courseType'] == courseType[0]
with assume:
assert res_first_course_data['grade'] == grade[0]
with assume:
assert res_first_course_data['isNormal'] == isNormal[0]
with assume:
assert res_first_course_data['normalPrice'] == float(normalPrice[0])
with assume:
assert res_first_course_data['perPeriodDuration'] == perPeriodDuration[0]
with assume:
assert res_first_course_data['priceType'] == priceType[0]
with assume:
assert res_first_course_data['productType'] == productType[0]
with assume:
assert res_first_course_data['registerGrade'] == registerGrade[0]
with assume:
assert res_first_course_data['subject'] == subject[0]
with assume:
assert res_first_course_data['teachForm'] == teachForm[0]
with assume:
assert res_first_course_data['term'] == term[0]
with assume:
assert res_first_course_data['totalPrice'] == totalPrice[0]
with assume:
assert res_first_course_data['year'] == year[0]
except:
print('查询课程失败')
raise
# 验证新增【精品定制课程】 # 验证新增【精品定制课程】
# 验证新增【集训班课程】 def test_create_vip_course_success(self):
# 验证新增【专题班课程】 json_data = Add_My_New_Vip_Course().init_course_data
# 验证新增【服务班课程】 # 获取新建课程的参数
courseName = json_data[0]['courseName'],
term = json_data[0]['term'],
subject = json_data[0]['subject'],
productType = json_data[0]['productType'],
year = json_data[0]['year'],
classType = json_data[0]['classType'],
grade = json_data[0]['grade'],
courseType = json_data[0]['courseType'],
normalPrice = json_data[0]['normalPrice'],
coursePrice = json_data[0]['coursePrice'],
totalPrice = json_data[0]['totalPrice'],
teachForm = json_data[0]['teachForm'],
courseDesc = json_data[0]['courseDesc'],
priceType = json_data[0]['priceType'],
perPeriodDuration = json_data[0]['perPeriodDuration'],
schools = json_data[0]['schools'],
# 新增课程
try:
add_res = education_courses_add_post(body=json_data, header=jyy_header)
with assume:
assert add_res['code'] == 0
with assume:
assert add_res['msg'] == '成功'
except:
print('新建精品课程失败')
raise
# 查询课程
try:
schoolAreas = schools[0][0]
schoolAreas = schoolAreas['schoolArea']
print(schoolAreas)
query_data = {"type": "not-click", "schoolAreas": [schoolAreas]}
params = {'pageNum': 1, 'pageSize': 10}
query_res = education_courses_query_post(params=params, body=query_data, header=jyy_header)
res_first_course_data = query_res['data']['content'][0]
with assume:
assert query_res['code'] == 0
with assume:
assert query_res['msg'] == '成功'
with assume:
assert res_first_course_data['classType'] == classType[0]
with assume:
assert res_first_course_data['courseDesc'] == courseDesc[0]
with assume:
assert res_first_course_data['courseName'] == courseName[0]
with assume:
assert res_first_course_data['coursePrice'] == float(coursePrice[0])
with assume:
assert res_first_course_data['courseType'] == courseType[0]
with assume:
assert res_first_course_data['grade'] == grade[0]
with assume:
assert res_first_course_data['normalPrice'] == float(normalPrice[0])
with assume:
assert res_first_course_data['perPeriodDuration'] == perPeriodDuration[0]
with assume:
assert res_first_course_data['priceType'] == priceType[0]
with assume:
assert res_first_course_data['productType'] == productType[0]
with assume:
assert res_first_course_data['subject'] == subject[0]
with assume:
assert res_first_course_data['teachForm'] == teachForm[0]
with assume:
assert res_first_course_data['term'] == term[0]
with assume:
assert res_first_course_data['totalPrice'] == totalPrice[0]
with assume:
assert res_first_course_data['year'] == year[0]
except:
print('查询精品课程失败')
raise
# 验证新增【集训班课程】
def test_create_jiXun_course_with_success(self):
json_data = Add_My_jiXun_Course().init_course_data
# 获取新建课程的参数
courseName = json_data[0]['courseName'],
term = json_data[0]['term'],
subject = json_data[0]['subject'],
productType = json_data[0]['productType'],
year = json_data[0]['year'],
classType = json_data[0]['classType'],
grade = json_data[0]['grade'],
registerGrade = json_data[0]['registerGrade'],
coursePeriod = json_data[0]['coursePeriod'],
courseType = json_data[0]['courseType'],
courseNumber = json_data[0]['courseNumber'],
normalPrice = json_data[0]['normalPrice'],
coursePrice = json_data[0]['coursePrice'],
totalPrice = json_data[0]['totalPrice'],
courseStatus = json_data[0]['courseStatus'],
teachForm = json_data[0]['teachForm'],
courseDesc = json_data[0]['courseDesc'],
priceType = json_data[0]['priceType'],
isTerm = json_data[0]['isTerm'],
perPeriodDuration = json_data[0]['perPeriodDuration'],
isNormal = json_data[0]['isNormal'],
schools = json_data[0]['schools'],
cContent = json_data[0]['cContent']
# 新增课程
try:
add_res = education_courses_add_post(body=json_data, header=jyy_header)
with assume:
assert add_res['code'] == 0
with assume:
assert add_res['msg'] == '成功'
except:
print('新建集训课程失败')
raise
# 查询课程
try:
schoolAreas = schools[0][0]
schoolAreas = schoolAreas['schoolArea']
query_data = {"type": "not-click", "schoolAreas": [schoolAreas]}
params = {'pageNum': 1, 'pageSize': 10}
query_res = education_courses_query_post(params=params, body=query_data, header=jyy_header)
res_first_course_data = query_res['data']['content'][0]
with assume:
assert query_res['code'] == 0
with assume:
assert query_res['msg'] == '成功'
with assume:
assert res_first_course_data['classType'] == classType[0]
with assume:
assert res_first_course_data['courseDesc'] == courseDesc[0]
with assume:
assert res_first_course_data['courseName'] == courseName[0]
with assume:
assert res_first_course_data['courseNumber'] == int(courseNumber[0])
with assume:
assert res_first_course_data['coursePeriod'] == float(coursePeriod[0])
with assume:
assert res_first_course_data['coursePrice'] == float(coursePrice[0])
with assume:
assert res_first_course_data['courseType'] == courseType[0]
with assume:
assert res_first_course_data['grade'] == grade[0]
with assume:
assert res_first_course_data['isNormal'] == isNormal[0]
with assume:
assert res_first_course_data['normalPrice'] == float(normalPrice[0])
with assume:
assert res_first_course_data['perPeriodDuration'] == perPeriodDuration[0]
with assume:
assert res_first_course_data['priceType'] == priceType[0]
with assume:
assert res_first_course_data['productType'] == productType[0]
with assume:
assert res_first_course_data['registerGrade'] == registerGrade[0]
with assume:
assert res_first_course_data['subject'] == subject[0]
with assume:
assert res_first_course_data['teachForm'] == teachForm[0]
with assume:
assert res_first_course_data['term'] == term[0]
with assume:
assert res_first_course_data['totalPrice'] == totalPrice[0]
with assume:
assert res_first_course_data['year'] == year[0]
except:
print('查询课程失败')
raise
# 验证新增【专题班课程】
def test_create_zuanTi_course_with_success(self):
json_data = Add_My_zuanTi_Course().init_course_data
# 获取新建课程的参数
courseName = json_data[0]['courseName'],
term = json_data[0]['term'],
subject = json_data[0]['subject'],
productType = json_data[0]['productType'],
year = json_data[0]['year'],
classType = json_data[0]['classType'],
grade = json_data[0]['grade'],
registerGrade = json_data[0]['registerGrade'],
coursePeriod = json_data[0]['coursePeriod'],
courseType = json_data[0]['courseType'],
courseNumber = json_data[0]['courseNumber'],
normalPrice = json_data[0]['normalPrice'],
coursePrice = json_data[0]['coursePrice'],
totalPrice = json_data[0]['totalPrice'],
courseStatus = json_data[0]['courseStatus'],
teachForm = json_data[0]['teachForm'],
courseDesc = json_data[0]['courseDesc'],
priceType = json_data[0]['priceType'],
isTerm = json_data[0]['isTerm'],
perPeriodDuration = json_data[0]['perPeriodDuration'],
isNormal = json_data[0]['isNormal'],
schools = json_data[0]['schools'],
cContent = json_data[0]['cContent']
# 新增课程
try:
add_res = education_courses_add_post(body=json_data, header=jyy_header)
with assume:
assert add_res['code'] == 0
with assume:
assert add_res['msg'] == '成功'
except:
print('新建专题课程失败')
raise
# 查询课程
try:
schoolAreas = schools[0][0]
schoolAreas = schoolAreas['schoolArea']
query_data = {"type": "not-click", "schoolAreas": [schoolAreas]}
params = {'pageNum': 1, 'pageSize': 10}
query_res = education_courses_query_post(params=params, body=query_data, header=jyy_header)
res_first_course_data = query_res['data']['content'][0]
with assume:
assert query_res['code'] == 0
with assume:
assert query_res['msg'] == '成功'
with assume:
assert res_first_course_data['classType'] == classType[0]
with assume:
assert res_first_course_data['courseDesc'] == courseDesc[0]
with assume:
assert res_first_course_data['courseName'] == courseName[0]
with assume:
assert res_first_course_data['courseNumber'] == int(courseNumber[0])
with assume:
assert res_first_course_data['coursePeriod'] == float(coursePeriod[0])
with assume:
assert res_first_course_data['coursePrice'] == float(coursePrice[0])
with assume:
assert res_first_course_data['courseType'] == courseType[0]
with assume:
assert res_first_course_data['grade'] == grade[0]
with assume:
assert res_first_course_data['isNormal'] == isNormal[0]
with assume:
assert res_first_course_data['normalPrice'] == float(normalPrice[0])
with assume:
assert res_first_course_data['perPeriodDuration'] == perPeriodDuration[0]
with assume:
assert res_first_course_data['priceType'] == priceType[0]
with assume:
assert res_first_course_data['productType'] == productType[0]
with assume:
assert res_first_course_data['registerGrade'] == registerGrade[0]
with assume:
assert res_first_course_data['subject'] == subject[0]
with assume:
assert res_first_course_data['teachForm'] == teachForm[0]
with assume:
assert res_first_course_data['term'] == term[0]
with assume:
assert res_first_course_data['totalPrice'] == totalPrice[0]
with assume:
assert res_first_course_data['year'] == year[0]
except:
print('查询专题课程失败')
raise
# 验证新增【服务班课程】
def test_create_fuWu_course_with_success(self):
json_data = Add_My_fuWu_Course().init_course_data
# 获取新建课程的参数
courseName = json_data[0]['courseName'],
term = json_data[0]['term'],
subject = json_data[0]['subject'],
productType = json_data[0]['productType'],
year = json_data[0]['year'],
classType = json_data[0]['classType'],
grade = json_data[0]['grade'],
registerGrade = json_data[0]['registerGrade'],
coursePeriod = json_data[0]['coursePeriod'],
courseType = json_data[0]['courseType'],
courseNumber = json_data[0]['courseNumber'],
normalPrice = json_data[0]['normalPrice'],
coursePrice = json_data[0]['coursePrice'],
totalPrice = json_data[0]['totalPrice'],
courseStatus = json_data[0]['courseStatus'],
teachForm = json_data[0]['teachForm'],
courseDesc = json_data[0]['courseDesc'],
priceType = json_data[0]['priceType'],
isTerm = json_data[0]['isTerm'],
perPeriodDuration = json_data[0]['perPeriodDuration'],
isNormal = json_data[0]['isNormal'],
schools = json_data[0]['schools'],
cContent = json_data[0]['cContent']
# 新增课程
try:
add_res = education_courses_add_post(body=json_data, header=jyy_header)
with assume:
assert add_res['code'] == 0
with assume:
assert add_res['msg'] == '成功'
except:
print('新建副线课程失败')
raise
# 查询课程
try:
schoolAreas = schools[0][0]
schoolAreas = schoolAreas['schoolArea']
query_data = {"type": "not-click", "schoolAreas": [schoolAreas]}
params = {'pageNum': 1, 'pageSize': 10}
query_res = education_courses_query_post(params=params, body=query_data, header=jyy_header)
res_first_course_data = query_res['data']['content'][0]
with assume:
assert query_res['code'] == 0
with assume:
assert query_res['msg'] == '成功'
with assume:
assert res_first_course_data['classType'] == classType[0]
with assume:
assert res_first_course_data['courseDesc'] == courseDesc[0]
with assume:
assert res_first_course_data['courseName'] == courseName[0]
with assume:
assert res_first_course_data['courseNumber'] == int(courseNumber[0])
with assume:
assert res_first_course_data['coursePeriod'] == float(coursePeriod[0])
with assume:
assert res_first_course_data['coursePrice'] == float(coursePrice[0])
with assume:
assert res_first_course_data['courseType'] == courseType[0]
with assume:
assert res_first_course_data['grade'] == grade[0]
with assume:
assert res_first_course_data['isNormal'] == isNormal[0]
with assume:
assert res_first_course_data['normalPrice'] == float(normalPrice[0])
with assume:
assert res_first_course_data['perPeriodDuration'] == perPeriodDuration[0]
with assume:
assert res_first_course_data['priceType'] == priceType[0]
with assume:
assert res_first_course_data['productType'] == productType[0]
with assume:
assert res_first_course_data['registerGrade'] == registerGrade[0]
with assume:
assert res_first_course_data['subject'] == subject[0]
with assume:
assert res_first_course_data['teachForm'] == teachForm[0]
with assume:
assert res_first_course_data['term'] == term[0]
with assume:
assert res_first_course_data['totalPrice'] == totalPrice[0]
with assume:
assert res_first_course_data['year'] == year[0]
except:
print('查询副线课程失败')
raise
# 验证复制课程正确 # 验证复制课程正确
def test_cope_course_success(self):
# 查询课程列表,获取课程id
try:
area = CreateCourseGlobalData.area
schoolArea = CreateCourseGlobalData.schoolArea
query_data = {"type": "not-click", "schoolAreas": [schoolArea]}
params = {'pageNum': 1, 'pageSize': 10}
query_res = education_courses_query_post(params=params, body=query_data, header=jyy_header)
res_first_course_data = query_res['data']['content'][0]
courseId = res_first_course_data['courseId']
except:
print('查询课程失败')
raise
# 通过课程id查询单个课程
try:
query_data = [courseId]
query_res = education_courses_queryByIds_post(body=query_data, header=jyy_header)
res_first_course_data = query_res['data'][0]
classType=res_first_course_data['classType']
courseContent=res_first_course_data['courseContent']
courseDesc=res_first_course_data['courseDesc']
courseId=res_first_course_data['courseId']
courseName=res_first_course_data['courseName']
courseNumber=res_first_course_data['courseNumber']
coursePeriod=res_first_course_data['coursePeriod']
coursePrice=res_first_course_data['coursePrice']
courseResignBeginDate=res_first_course_data['courseResignBeginDate']
courseResignEndDate=res_first_course_data['courseResignEndDate']
courseSaleBeginDate=res_first_course_data['courseSaleBeginDate']
courseSaleEndDate=res_first_course_data['courseSaleEndDate']
courseSignBeginDate=res_first_course_data['courseSignBeginDate']
courseSignEndDate=res_first_course_data['courseSignEndDate']
courseStatus=res_first_course_data['courseStatus']
courseType=res_first_course_data['courseType']
grade=res_first_course_data['grade']
isNormal=res_first_course_data['isNormal']
normalPrice=res_first_course_data['normalPrice']
perPeriodDuration=res_first_course_data['perPeriodDuration']
priceType=res_first_course_data['priceType']
productType=res_first_course_data['productType']
registerGrade=res_first_course_data['registerGrade']
remarks=res_first_course_data['remarks']
schoolArea=res_first_course_data['schoolArea'] # "[{\"id\":10253039,\"courseId\":10041258,\"area\":2382,\"schoolArea\":2371}]"
schoolAreaNum=res_first_course_data['schoolAreaNum']
sectionSetting=res_first_course_data['sectionSetting']
status=res_first_course_data['status']
subject=res_first_course_data['subject']
targetNum=res_first_course_data['targetNum']
teachForm=res_first_course_data['teachForm']
term=res_first_course_data['term']
textbookId=res_first_course_data['textbookId']
totalPrice=res_first_course_data['totalPrice']
uphalfCoursePeriod=res_first_course_data['uphalfCoursePeriod']
downhalfCoursePeriod=res_first_course_data['downhalfCoursePeriod']
year=res_first_course_data['year']
except:
print('查询课程失败')
raise
else:
schoolArea=eval(schoolArea)
pre_area = schoolArea[0]["area"]
pre_schoolArea = schoolArea[0]["schoolArea"]
pre_id = schoolArea[0]["id"]
json_data = [{"classType": classType, "cContent": [], "courseDesc": courseDesc, "courseName": courseName,
"courseNumber": courseNumber, "coursePeriod": coursePeriod, "coursePrice": coursePrice, "normalPrice": normalPrice, "courseStatus": courseStatus,
"courseType": courseType, "grade": grade, "productType": productType, "registerGrade": registerGrade, "remarks": remarks,
"schools": [{"id": pre_id, "courseId": courseId, "area": pre_area, "schoolArea": pre_schoolArea}],
"subject": subject, "term": term, "teachForm": teachForm, "perPeriodDuration": perPeriodDuration, "totalPrice": totalPrice,
"year": year, "priceType": priceType, "courseSaleBeginDate": courseSaleBeginDate, "courseSaleEndDate": courseSaleEndDate,
"courseSignBeginDate": courseSignBeginDate, "courseSignEndDate": courseSignEndDate, "courseResignBeginDate": courseResignBeginDate,
"courseResignEndDate": courseResignEndDate, "sectionSetting": sectionSetting, "downhalfCoursePeriod": downhalfCoursePeriod,
"uphalfCoursePeriod": uphalfCoursePeriod, "isNormal": isNormal}]
# 获取新建课程的参数
courseName = courseName,
term = term,
subject = subject,
productType = productType,
year = year,
classType = classType,
grade = grade,
registerGrade = registerGrade,
coursePeriod = coursePeriod,
courseType = courseType,
courseNumber = courseNumber,
normalPrice = normalPrice,
coursePrice = coursePrice,
totalPrice = totalPrice,
courseStatus = courseStatus,
teachForm = teachForm,
courseDesc = courseDesc,
priceType = priceType,
perPeriodDuration = perPeriodDuration,
isNormal = isNormal
# 复制课程
try:
add_res = education_courses_add_post(body=json_data, header=jyy_header)
with assume:
assert add_res['code'] == 0
with assume:
assert add_res['msg'] == '成功'
except:
print('复制课程失败')
raise
try:
area = schoolArea[0]["area"]
schoolArea = schoolArea[0]["schoolArea"]
query_data = {"type": "not-click", "schoolAreas": [schoolArea]}
params = {'pageNum': 1, 'pageSize': 10}
query_res = education_courses_query_post(params=params, body=query_data, header=jyy_header)
res_first_course_data = query_res['data']['content'][0]
with assume:
assert query_res['code'] == 0
with assume:
assert query_res['msg'] == '成功'
with assume:
assert res_first_course_data['classType'] == classType[0]
with assume:
assert res_first_course_data['courseDesc'] == courseDesc[0]
with assume:
assert res_first_course_data['courseName'] == courseName[0]
with assume:
assert res_first_course_data['courseNumber'] == courseNumber[0]
with assume:
assert res_first_course_data['coursePeriod'] == coursePeriod[0]
with assume:
assert res_first_course_data['coursePrice'] == coursePrice[0]
with assume:
assert res_first_course_data['courseType'] == courseType[0]
with assume:
assert res_first_course_data['grade'] == grade[0]
with assume:
assert res_first_course_data['isNormal'] == isNormal
with assume:
assert res_first_course_data['normalPrice'] == normalPrice[0]
with assume:
assert res_first_course_data['perPeriodDuration'] == perPeriodDuration[0]
with assume:
assert res_first_course_data['priceType'] == priceType[0]
with assume:
assert res_first_course_data['productType'] == productType[0]
with assume:
assert res_first_course_data['registerGrade'] == registerGrade[0]
with assume:
assert res_first_course_data['subject'] == subject[0]
with assume:
assert res_first_course_data['teachForm'] == teachForm[0]
with assume:
assert res_first_course_data['term'] == term[0]
with assume:
assert res_first_course_data['totalPrice'] == totalPrice[0]
with assume:
assert res_first_course_data['year'] == year[0]
except:
print('查询课程失败')
raise
# 验证修改课程正确--所有项 # 验证修改课程正确--所有项
# 验证修改课程正确--必填项 # 验证修改课程正确--必填项
# 验证修改课程价格 # 验证修改课程价格
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment