def test_p1_class_listGradeAndClassBySchoolId(self): """ title: 根据学校id获取学校下所有班级 url: /schooluserservice/class/listGradeAndClassBySchoolId author: 章志君 """ teacher_web = teacher(web_client(username=student_user['username'], password=student_user['password'])) res = teacher_web.class_listGradeAndClassBySchoolId(schoolId=schoolid) print(res) self.assertEqual("200", res['code']) graduationYears = [i['graduationYear'] for i in res['data']] self.assertIn(expireyear, graduationYears) for i in res['data']: self.assertTrue(len(i['classInfoList']) > 0)
def test_p1_class_listClassInfoBySchoolAndGradeContainDisbanded(self): """ title: 创建班级解散班级,获取学校的所有班级(包含行政班、教学班、已解散的班级) url: /schooluserservice/class/listClassInfoBySchoolAndGradeContainDisbanded author: 章志君 """ teacher_web = teacher(web_client(username=principal_user['username'])) res = teacher_web.class_listClassInfoBySchoolAndGradeContainDisbanded(schoolId=schoolid, gradeYearList=[expireyear]) print(res) self.assertEqual("200", res['code']) classIds = [i['classId'] for i in res['data']] self.assertIn(str(groupid_xingzheng), classIds) self.assertIn(str(groupid_jiaoxue), classIds) self.assertIn(str(groupid_isdeleted), classIds)
def test_p1_web_get_SbrPaperExam(self): """ title: web获取校本试卷作业详情 url: /api/services/HomeworkService/homework/getSbrHomeworkInfo4Answer author: 田彦涛 """ student_web = teacher(web_client(username=student_user['username'], password=student_user['password'])) res = student_web.sbr_getSbrHomeworkInfo4Answer(homeworkid=self.homeworkid) print(res) self.assertEqual(200, res['code']) self.assertEqual(self.homeworkid, res['data']['homeworkid']) print(res['data']['syllabuses']) self.assertEqual(syllabuses_expect, res['data']['syllabuses']) self.assertEqual(sbr_paperid, res['data']['paperid'])
def __analogtea_submithomework(self, type): teacher_web = teacher(web_client(username=principal_user['username'])) title = '模拟选科问卷type{}'.format(type) groups = [] res = teacher_web.analogtea_getquestionnaireinfo(grade=1, type=type) for i in res['data']['subjectlist']: groups.append(i['id']) res = teacher_web.analogtea_submithomework( grade=1, type=type, title=title, subjectgroups=groups, endtime=CaseServices.get_deadlinetime()) return res['data']
def test_p1_2_manageteacher_pagerQueryTeacherInfo(self): """ title: 年级主任分页查询管理教师列表 url: /api/eteacherproduct/teacher/manage/pagerQueryTeacherInfo author: 章志君 """ teacher_web = teacher( web_client(username=grademaster_user['username'])) res = teacher_web.manageteacher_pagerQueryTeacherInfo( schoolId=schoolid, pageIndex=1, pageSize=100) print(res) self.assertEqual("200", res['code']) self.assertTrue(len(res['data']) > 0) self.assertIn(principal_user['username'], str(res['data'])) self.assertIn(psychologicalteacher_user['username'], str(res['data'])) self.assertIn(headteacher_user['username'], str(res['data'])) self.assertIn(grademaster_user['username'], str(res['data'])) self.assertIn(teacher_user['username'], str(res['data'])) self.assertIn(classheadteacher_user['username'], str(res['data'])) self.assertIn(teacher_mix_user['username'], str(res['data'])) self.assertNotIn(normalteacher_user['username'], str(res['data'])) for i in res['data']: if i['cellphone'] == cellphone: self.assertEqual("校领导", i['roleAliasName']) self.assertEqual("全部年级全部班级", i['manageClassesName']) if i['cellphone'] == psychologicalteacher_user['username']: self.assertEqual("心理老师", i['roleAliasName']) self.assertEqual("全部年级全部班级", i['manageClassesName']) if i['cellphone'] == headteacher_user['username']: self.assertEqual("班主任", i['roleAliasName']) self.assertEqual( "{0}({1})".format(group_name_xingzheng, expireyear - 3), i['manageClassesName']) if i['cellphone'] == classheadteacher_user['username']: self.assertEqual("教学班主任", i['roleAliasName']) self.assertEqual( "{0}({1})".format(group_name_jiaoxue, expireyear - 3), i['manageClassesName']) if i['cellphone'] == teacher_user['username']: self.assertEqual("任课老师", i['roleAliasName']) self.assertEqual( "{0}({1})".format(group_name_xingzheng, expireyear - 3), i['teachClassesName']) if i['cellphone'] == grademaster_user['username']: self.assertEqual("年级主任", i['roleAliasName']) self.assertEqual( "{0}全部班级({1}年入学)".format(gradename, expireyear - 3), i['manageClassesName']) self.assertEqual(teacher_web.client.user_id, i['userId'])
def test_p1_step08_type14_analogtea_posthomeworkstatistics(self): """ title: 教师端查看3+1+2的模拟选科分析 url: /api/teacher/analogselectionfortea/posthomeworkstatistics author: 章志君 """ homework_id = self.__analogtea_submithomework(type=4) res = self.__assert_analogstu_gethomeworkinfo(homework_id, type=4) self.__analogstu_submithomework_and_assert(homework_id=homework_id, lastsubjects=[], type=4, subjectgroupid=res[0]['id'], subject_assert='物理、化学、生物') self.__assert_analogtea_GetListByPage(homework_id) teacher_web = teacher(web_client(username=principal_user['username'])) self.__assert_analogtea_gethomeworkstatisticsinfo( teacher_web, homework_id, 4) res = teacher_web.analogtea_posthomeworkstatistics( homeworkid=homework_id, classId=0) print(res) self.assertEqual(200, res['code']) for i in res['data']['onesubjectanalyselist']: self.assertEqual( "1", i['totalpeople'] ) if i['subjectname'] == "生物" or i['subjectname'] == "化学" or i[ 'subjectname'] == "物理" else self.assertEqual( "0", i['totalpeople']) for i in res['data']['twosubjectanalyselist']: self.assertEqual( "1", i['totalpeople'] ) if i['subjectname'] == "化学、生物" else self.assertEqual( "0", i['totalpeople']) for i in res['data']['threesubjectanalyselist']: self.assertEqual( "1", i['totalpeople'] ) if i['subjectname'] == "物理、化学、生物" else self.assertEqual( "0", i['totalpeople']) for i in res['data']['physicsorhistorylist']: self.assertEqual( "1", i['totalpeople'] ) if i['subjectname'] == "物理" else self.assertEqual( "0", i['totalpeople']) self.assertEqual("{0}({1}年入学)".format(gradename, expireyear - 3), res['data']['classname']) self.assertTrue(res['data']['totalstudentnum'] >= 2) self.assertTrue(res['data']['joinstudentnum'] >= 1) self.assertTrue(res['data']['unjoinstudentnum'] >= 1)
def test_get_question_point_by_subject(self): """ title: 题库挑题-获取知识点目录树 url: /api/homeworkprod/resource/question/getQuestionPointBySubject author: 田彦涛 """ teacher_web = teacher( web_client(teacher_user['username'], teacher_user['password'])) subjectEn = CaseServices.get_subjectId_and_subjectEn(teacher_web)[1] res = teacher_web.homeworkprod_getQuestionPointBySubject( schoolId=schoolid, subjectEn=subjectEn) print(res) self.assertEqual("200", res['code']) self.assertTrue(res['success']) self.assertTrue(len(res['data']) > 0)
def test_p3_get_grades_by_psychologicalteacher(self): """ title: 心理老师获取使用地图可选年级列表 url: /api/services/homeworkpromotion/homeworkpromotion/grades author: 田彦涛 """ teacher_web = teacher(web_client(username=psychologicalteacher_user['username'])) res = teacher_web.hp_grades() print(res) except_data = [ {'text': '高一({}年入学)'.format(current_school_year), 'value': 1, 'checked': False}, {'text': '高二({}年入学)'.format(current_school_year-1), 'value': 2, 'checked': False}, {'text': '高三({}年入学)'.format(current_school_year-2), 'value': 3, 'checked': False} ] self.assertEqual(except_data, res['data'])
def test_p1_class_listClassDetailAndStudentsByClassIdListContainLeft(self): """ title: 根据班级id获取班级信息及学生信息 url: /schooluserservice/class/listClassDetailAndStudentsByClassIdList author: 章志君 """ teacher_web = teacher(web_client(username=student_user['username'], password=student_user['password'])) res = teacher_web.class_listClassDetailAndStudentsByClassIdList(schoolId=schoolid, classIdList=[groupid_xingzheng, groupid_jiaoxue]) print(res) self.assertEqual("200", res['code']) classIds = [i['classId'] for i in res['data']] self.assertIn(str(groupid_xingzheng), classIds) self.assertIn(str(groupid_jiaoxue), classIds) self.assertTrue(len(res['data'][0]['studentList']) > 0) self.assertTrue(len(res['data'][1]['studentList']) > 0)
def test_p3_queryTeacherRoleAndSchoolInfo_by_student(self): """ title: 学生账号获取角色信息 url: /api/eteacherproduct/teacher/manage/queryTeacherRoleAndSchoolInfo author: 田彦涛 """ teacher_web = teacher( web_client(username=student_user['username'], password=student_user['password'])) res = teacher_web.queryTeacherRoleAndSchoolInfo(schoolid=schoolid) print(res) self.assertEqual("200", res['code']) self.assertEqual(schoolid, res['data']['schoolId']) self.assertEqual([], res['data']['roleList']) self.assertTrue(res['data']['userName'])
def test_p1_class_getClassStudentListBySchoolAndGrade(self): """ title: 获取学校年级下的学生列表 url: /schooluserservice/class/getClassStudentListBySchoolAndGrade author: 章志君 """ teacher_web = teacher(web_client(username=principal_user['username'])) res = teacher_web.class_getClassStudentListBySchoolAndGrade(schoolId=schoolid, graduationYear=expireyear) print(res) self.assertEqual("200", res['code']) for i in res['data']: self.assertTrue(i['classId']) self.assertTrue(i['userId']) self.assertEqual(str(schoolid), i['schoolId']) self.assertEqual(expireyear, i['graduationYear'])
def test_p1_moralEdu_gradeClassList(self): """ title: 家长德育报告-年级,班级筛选数据 url: /moralEdu/gradeClassList author: 张水琴 """ teacher_web = teacher( web_client(username=new_senior_user['username'], password=new_senior_user['password'])) res = teacher_web.eteacherproduct_school_getSchoolUserInfo() schoolid = res['data']['schoolId'] res1 = teacher_web.moralEdu_gradeClassList(schoolId=schoolid) print(res1) self.assertEqual('200', res1['code'])
def test_p1_3_role_getUserRoleWithGradeAndTeachClass(self): """ title: 获取用户角色(管理年级,教授班级)_任课老师 url: /schooluserservice/role/getUserRoleWithGradeAndTeachClass author: 章志君 """ teacher_web = teacher(web_client(username=teacher_user['username'])) res = teacher_web.role_getUserRoleWithGradeAndTeachClass( userId=teacher_web.client.user_id) print(res) self.assertEqual("200", res['code']) roles = [i['role'] for i in res['data']['roleInfoList']] self.assertEqual(str(schoolid), res['data']['schoolId']) self.assertIn(role['teacher_user'], roles) self.assertIn(str(groupid_xingzheng), str(res['data']))
def test_p1_3_role_getUserRole(self): """ title: 仅获取用户角色_混合角色 url: /schooluserservice/role/getUserRole author: 章志君 """ teacher_web = teacher( web_client(username=teacher_mix_user['username'])) res = teacher_web.role_getUserRole(userId=teacher_web.client.user_id) print(res) self.assertEqual("200", res['code']) roles = [i['role'] for i in res['data']['roleInfoList']] self.assertEqual(str(schoolid), res['data']['schoolId']) self.assertIn(role['principal_user'], roles) self.assertTrue(len(roles) >= 2)
def test_p1_3_role_getUserRoleWithGrade(self): """ title: 获取用户角色(管理年级)_行政班班主任 url: /schooluserservice/role/getUserRoleWithGrade author: 章志君 """ teacher_web = teacher( web_client(username=headteacher_user['username'])) res = teacher_web.role_getUserRoleWithGrade( userId=teacher_web.client.user_id) print(res) self.assertEqual("200", res['code']) roles = [i['role'] for i in res['data']['roleInfoList']] self.assertEqual(str(schoolid), res['data']['schoolId']) self.assertIn(role['headteacher_user'], roles)
def test_get_wrong_question_points(self): """ title: 题库挑题-学生错题-获取知识点目录 url: /api/homeworkprod/resource/wrongQuestion/getWrongQuestionPoints author: 田彦涛 """ teacher_web = teacher( web_client(teacher_user['username'], teacher_user['password'])) subjectid, subjectEn = CaseServices.get_subjectId_and_subjectEn( teacher_web) res = teacher_web.homeworkprod_getWrongQuestionPoints( subjectId=subjectid, subjectEn=subjectEn, schoolId=schoolid) print(res) self.assertEqual("200", res['code']) self.assertTrue(res['success'])
def test_p1_4_role_getUserRoleWithGradeAndClass(self): """ title: 获取用户角色(管理年级,教授班级、管辖班级)(高并发业务场景)_教学班主任, 管理对应的班级 url: /schooluserservice/role/getUserRoleWithGradeAndClass author: 章志君 """ teacher_web = teacher( web_client(username=classheadteacher_user['username'])) res = teacher_web.role_getUserRoleWithGradeAndClass( userId=teacher_web.client.user_id) print(res) self.assertEqual("200", res['code']) self.assertEqual(str(schoolid), res['data']['schoolId']) classIds = [i['classId'] for i in res['data']['manageClassList']] self.assertEqual([str(groupid_jiaoxue)], list(set(classIds)))
def test_p1_moralEdu_report_schoolCourseInfo(self): """ title: 家长德育报告-全校课程情况 url: /moralEdu/report/schoolCourseInfo author: 张水琴 """ teacher_web = teacher( web_client(username=new_senior_user['username'], password=new_senior_user['password'])) res = teacher_web.eteacherproduct_school_getSchoolUserInfo() schoolid = res['data']['schoolId'] res1 = teacher_web.moralEdu_report_schoolCourseInfo(schoolId=schoolid) print(res1) self.assertEqual('200', res1['code'])
def test_p1_studentManage_joinClass_old(self): """ title: 学生加入班级(旧流程) url: /api/eteacherproduct/studentManage/oldJoinClass author: 章志君 """ teacher_web = teacher(web_client(username=student200_user['username'])) res1 = self.oa.oaclass_queryClassInfo(classId=groupid_xingzheng) print(res1) headTeacherName = res1['data']['headTeacherName'] res = teacher_web.studentManage_oldJoinClass(classId=groupid_xingzheng, headMasterName=headTeacherName, userId=teacher_web.client.user_id) print(res) self.assertEqual("200", res['code']) self.oa.oaclass_kickStudent(classId=groupid_xingzheng, userId=teacher_web.client.user_id, updateUser="******")
def test_p1_studentManage_getMySchoolAndGradeClassList(self): """ title: 获取学生所在学校信息和其对应年级的所有班级信息 url: /api/eteacherproduct/studentManage/getMySchoolAndGradeClassList author: 章志君 """ teacher_web = teacher(web_client(username=student_user['username'], password=student_user['password'])) res = teacher_web.studentManage_getMySchoolAndGradeClassList() print(res) self.assertEqual("200", res['code']) self.assertEqual(schoolid, res['data']['schoolInfo']['id']) self.assertEqual(expireyear, res['data']['gradeList'][0]['graduationYear']) for i in res['data']['gradeList'][0]['adminClasses']: if i['classId'] == groupid_xingzheng | i['classId'] == groupid_jiaoxue: self.assertTrue(i['ifJoinClass'])
def test_p1_moralEdu_report_teacherView(self): """ title: 教师德育报告-教师查看情况 周期(1:1个月 6:6个月 12:一年) url: /moralEdu/report/teacherView author: 张水琴 """ teacher_web = teacher( web_client(username=new_senior_user['username'], password=new_senior_user['password'])) res = teacher_web.eteacherproduct_school_getSchoolUserInfo() schoolid = res['data']['schoolId'] res1 = teacher_web.moralEdu_report_teacherView(schoolId=schoolid, period=1) print(res1) self.assertEqual('200', res1['code'])
def test_p1_step01_career_addbasket(self): """ title: 验证生涯视频作业, 清空作业栏 -> 添加多讲课到作业篮 url: /api/teacher/assignhomeworkfortea/addbasket author: 章志君 """ teacher_web = teacher(web_client(username=principal_user['username'])) res = teacher_web.career_clearbasket(typeid=1, kemu='10') self.assertEqual(200, res['code']) self.assertEqual("清空成功", res['data']) self.assertEqual("执行成功", res['msg']) res1 = teacher_web.career_addbasket( basketforteaaddinput=basketforteaaddinput2) print(res1) self.assertEqual(200, res1['code']) self.assertEqual(3, res1['data'])
def test_p1_moralEdu_homepageStatistics_grademaster(self): """ title: 首页概览统计--年级主任 url: /moralEdu/homepageStatistics author: 张水琴 """ teacher_web = teacher( web_client(username=grademaster_user['username'], password=grademaster_user['password'])) res = teacher_web.eteacherproduct_school_getSchoolUserInfo() schoolid = res['data']['schoolId'] res1 = teacher_web.moralEdu_homepageStatistics(schoolid) print(res1) self.assertEqual('200', res1['code']) self.assertEqual(2, res1['data']['role'])
def test_get_chapter_filter_paper_type(self): """ title: 试卷挑题-根据章节id获取试卷类型 url: /api/homeworkprod/resource/paper/getChapterFilterPaperType author: 田彦涛 """ teacher_web = teacher( web_client(teacher_user['username'], teacher_user['password'])) chapterid = teacher_web.homeworkprod_getPaperTreeCategory( subjectId=1, schoolId=schoolid)['data'][0]['id'] res = teacher_web.homeworkprod_getChapterFilterPaperType( chapterId=chapterid, schoolId=schoolid) print(res) self.assertEqual("200", res['code']) self.assertTrue(res['success']) self.assertTrue(len(res['data']) > 0)
def test_p1_1_studentManage_getSchoolAndGradeClassList(self): """ title: 未加班学生根据学校ID获取学校信息和该学校所有年级下的班级信息,默认每个年级都至少有一个班级 url: /api/eteacherproduct/studentManage/getSchoolAndGradeClassList author: 章志君 """ teacher_web = teacher(web_client(username=student00_user['username'], password=student00_user['password'])) res = teacher_web.studentManage_getSchoolAndGradeClassList(schoolId=schoolid) print(res) self.assertEqual("200", res['code']) self.assertEqual(schoolid, res['data']['schoolInfo']['id']) graduationYears = [i['graduationYear'] for i in res['data']['gradeList']] self.assertIn(expireyear, graduationYears) self.assertTrue(len(graduationYears) >= 3) for j in res['data']['gradeList']: self.assertTrue(len(j['adminClasses']) > 0)
def test_p1_2_teacher_getTeachInfoListBySchoolAndClass(self): """ title: 根据学校ID和班级ID查询老师教授班级信息列表_教学班,(teacherRole教授角色属性(教学班班主任=200)) url: /schooluserservice/teacher/getTeachInfoListBySchoolAndClass author: 章志君 """ teacher_web = teacher( web_client(username=classheadteacher_user['username'])) res = teacher_web.teacher_getTeachInfoListBySchoolAndClass( schoolId=schoolid, classId=groupid_jiaoxue) print(res) self.assertEqual("200", res['code']) self.assertEqual(200, res['data'][0]['teacherRole']) self.assertEqual(str(teacher_web.client.user_id), res['data'][0]['userId']) self.assertEqual(1, res['data'][0]['teachSubjectId'])
def test_p1_moralEdu_report_parentsCourseViewDetail(self): """ title: 家长德育报告-家长看课详情 url: /moralEdu/report/parentsCourseViewDetail author: 张水琴 """ teacher_web = teacher( web_client(username=new_senior_user['username'], password=new_senior_user['password'])) res = teacher_web.eteacherproduct_school_getSchoolUserInfo() schoolid = res['data']['schoolId'] res1 = teacher_web.moralEdu_report_parentsCourseViewDetail( schoolId=schoolid, grade=-1, classId=-1, period=1) print(res1) self.assertEqual('200', res1['code'])
def test_hp_getclasseswithgradeinfo_by_headteacher(self): """ title: 行政班班主任获取使用地图-学科提分可布置范围 url: /api/services/homeworkpromotion/homeworkpromotion/getclasseswithgradeinfo author: 田彦涛 """ teacher_principal = teacher( web_client(username=headteacher_user['username'], password=headteacher_user['password'])) res = teacher_principal.hp_getclasseswithgradeinfo(actiontype=2, promotionmoduletype=1) print(res) self.assertEqual(200, res['code']) self.assertEqual(1, len(res['data'])) self.assertEqual(1, res['data'][0]['homeworksetstate']) self.assertEqual(expireyear, res['data'][0]['expireyear']) self.assertEqual(groupid_xingzheng, res['data'][0]['classlist'][0]['classid']) self.assertTrue(res['data'][0]['classlist'][0]['members'] > 0)
def test_p1_studentManage_checkAddSingleStudentToClass(self): """ title: 学生加班校验,根据获取的令牌建议验证班主任信息(班主任名字错误) url: /api/eteacherproduct/studentManage/checkAddSingleStudentToClass,/api/eteacherproduct/studentManage/joinClass author: 章志君 """ teacher_web = teacher(web_client(username=student00_user['username'], password=student00_user['password'])) res = teacher_web.studentManage_checkAddSingleStudentToClass(classId=groupid_xingzheng) print(res) self.assertEqual("200", res['code']) self.assertTrue(res['data']['hasHeadTeacher']) tk = res['data']['token'] res2 = teacher_web.studentManage_joinClass(token=tk, headMasterName='13435436') print(res2) self.assertEqual("022620", res2['code']) self.assertEqual("班主任姓名不匹配", res2['msg'])
def test_get_paper_info(self): """ title: 试卷挑题-根据试卷id获取试卷详情 url: /api/homeworkprod/resource/paper/getPaperInfo author: 田彦涛 """ teacher_web = teacher( web_client(teacher_user['username'], teacher_user['password'])) paperid = CaseServices.get_paper_id(teacher_web) res = teacher_web.homeworkprod_getPaperInfo(paperId=paperid, schoolId=schoolid) print(res) self.assertEqual("200", res['code']) self.assertTrue(res['success']) self.assertTrue(len(res['data']) > 0) self.assertTrue(len(res['data']['questionList']) > 0)