def test_case_get_teacher_course_list(self): teacherId_list = dataHandler.get_teacherId_list() for teacherId in teacherId_list: customize_body = {"pageNum": 1, "pageSize": 10, "teacherId": teacherId} api_info = Basic().get_api_by_name("get_teacher_course_list") content = Basic().send_request(**api_info,customize_body=customize_body) assert content.status_code == 200
def test_case_4_update_teacher_status_by_id(self): params = "teacherId=25"+"&&status=1" api_info = Basic().get_api_by_name("update_teacher_status_by_id", customize_params=params) content = Basic().send_request(**api_info) # print(content.text) assert content.status_code == 200 assert content.text == "{\"code\":1000,\"msg\":\"修改成功\"}"
def test_case_get_teacher_details(self): teacherId_list = dataHandler.get_teacherId_list() for teacherId in teacherId_list: params = "teacherId="+str(teacherId) api_info = Basic().get_api_by_name("get_teacher_details", customize_params=params) content = Basic().send_request(**api_info) assert content.status_code == 200
def test_case_get_course_list(self): api_info = Basic().get_api_by_name("get_course_label_listall") content = Basic().send_request(**api_info) assert content.status_code == 200 # print(content.text) # 包含clabelId TestCourseLabelController.course_list_dict = dataHandler().str_to_dict( content.text)
def test_case_3_del_information_by_id(self): params = "informationId=15" api_info = Basic().get_api_by_name("del_information_by_id", customize_params=params) content = Basic().send_request(**api_info) # print(content.text) assert content.status_code == 200
def test_case_4_update_advert_by_status(self): param= "advertId="+str(self.advert_id)+"&&status="+str(2) api_info = Basic().get_api_by_name("update_advert_by_status", customize_params=param) content = Basic().send_request(**api_info) # print(content.text) assert content.status_code == 200 assert content.text == "{\"code\":1000,\"msg\":\"修改成功\"}"
def test_case_3_del_teacher_by_id(self): params = "teacherId=25"#+str(self.teacher_id) api_info = Basic().get_api_by_name("del_teacher_by_id", customize_params=params) content = Basic().send_request(**api_info) # print(content.text) assert content.status_code == 200 assert content.text == "{\"code\":1000,\"msg\":\"删除老师成功\"}"
def test_case_3_del_information_by_id(self): params = "informationId=16&&status=2" api_info = Basic().get_api_by_name("update_information_status_by_id", customize_params=params) content = Basic().send_request(**api_info) # print(content.text) assert content.status_code == 200 assert content.text == "{\"code\":1000,\"msg\":\"修改成功\"}"
def test_case_1_get_admin_by_id(self): admin_id = "1" api_info = Basic().get_api_by_name("get_admin_by_id") response = Basic().send_request(admin_id, **api_info) assert response.status_code == 200 content_dict = dataHandler().str_to_dict(response.text) dataHandler().traverse_get_list_from_dict(content_dict) TestAdminController.admin_info = dataHandler.get_admin_info_dict()
def test_case_5_del_advert_by_id(self): param = "advertId="+str(self.advert_id) # print(param) api_info = Basic().get_api_by_name("del_advert_by_id", customize_params=param) content = Basic().send_request(**api_info) # print(content.text) assert content.status_code == 200 assert content.text == "{\"code\":1000,\"msg\":\"删除成功\"}"
def test_case_3_update_advert_by_id(self): body = {"advertId": self.advert_id, "link": "customize_link", "linkContent": "customize_content", "linkId": "1", "photo": "photo", "position": 2, "title": "mytitle", "type": 2} api_info = Basic().get_api_by_name("update_advert_by_id", customize_body=body) content = Basic().send_request(**api_info) # print(content.text) assert content.status_code == 200
def test_case_2_get_admin_list(self): # print(self.admin_info) customize_admin_info = self.admin_info customize_admin_info["pageNum"] = 1 customize_admin_info["pageSize"] = 10 api_info = Basic().get_api_by_name("get_admin_list", customize_body=customize_admin_info) content = Basic().send_request(**api_info) assert content.status_code == 200
def test_get_id_advert(self): # print(self.index_content_list) for content in self.index_content_list: dataHandler().traverse_get_list_from_dict(content) advertId_list = dataHandler.get_advertId_list() for advertId in advertId_list: # 23 params = "advertId=" + str(advertId) api_info = Basic().get_api_by_name("get_id_advert", customize_params=params) content = Basic().send_request(**api_info) assert content.status_code == 200
def test_case_get_course(self): pidList = dataHandler().traverse_get_list_from_dict( TestCourseLabelController.course_list_dict) for pid in pidList: param_pid = "pid=" + str(pid) # print(param_pid) api_info = Basic().get_api_by_name("get_course_label_list", customize_params=param_pid) content = Basic().send_request(**api_info) # print(content.text) assert content.status_code == 200
def test_case_1_add_advert(self): body = {"advertId": 814, "link": "123456", "linkContent": "123456", "linkId": "123456", "photo": "123456", "position": 1, "title": "123456", "type": 1} api_info = Basic().get_api_by_name("add_advert_edu_teacher", customize_body=body) content = Basic().send_request(**api_info) # print(content.text) dataHandler().traverse_get_list_from_dict(dataHandler().str_to_dict(content.text)) advertId_list = dataHandler.get_advertId_list() # print(advertId_list) TestAdvertController.advert_id = advertId_list[0] assert content.status_code == 200
def test_get_index_advert(self): for advert_index in GlobalConfig.adver_index_list: # print(advert_index) params = "position=" + str(advert_index) api_info = Basic().get_api_by_name("get_index_advert", customize_params=params) content = Basic().send_request(**api_info) assert content.status_code == 200 # print(content.text) self.index_content_list.append(dataHandler().str_to_dict( content.text))
def test_case_course_order(self): cid_list = dataHandler().traverse_get_list_from_dict(TestCourseOrderController.course_list_dict) for cid in cid_list: # 73 # print(cid) customize_body = {"cid": cid, "userId": GlobalConfig.userId} dataHandler.cId = cid # print(dataHandler.getCid()) # customize_body = "{\"cid\":"+"\""+str(cid)+"\""+",\"userId\":"+"\""+str(15)+"\"}" api_info = Basic().get_api_by_name("get_course_order", customize_body=customize_body) content = Basic().send_request(**api_info) # print(content.text) assert content.status_code == 200
def test_case_get_course_search(self): dataHandler().traverse_get_list_from_dict(TestCourseController.content_dict) value_dict = dataHandler.get_value_dict() # print(value_dict) ctypeId = value_dict["ctypeId"] # 2 date = "2020-08-31" keyword = "学科" pageNum = 1 pageSize = 10 customize_body = {"ctypeId": ctypeId,"date": date,"keyword": keyword,"pageNum": pageNum,"pageSize": pageSize} api_info = Basic().get_api_by_name("get_course_search", customize_body=customize_body) # print(api_info) content = Basic().send_request(**api_info) assert content.status_code == 200
def test_case_3_del_information_by_id(self): body = { "informationId": 16, "introduction": "string", "photo": "no", "source": "no", "text": "wu", "title": "change test" } api_info = Basic().get_api_by_name("update_information_info_by_id", customize_body=body) content = Basic().send_request(**api_info) print(content.text) assert content.status_code == 200
def test_case_5_update_teacher_info_by_id(self): body = { "teacherId": 25, "advertPhoto": "string", "detailIntruduction": "string", "educationalBackground": 3, "graduatedSchool": "Gongye大学2", "headPhoto": "string", "name": "xiaozheng", "phone": "12937890734", "positional": "中级", "recommend": 0, "sex": 1, "summary": "英语课程,来这ba" } api_info = Basic().get_api_by_name("update_teacher_info_by_id", customize_body=body) content = Basic().send_request(**api_info) # print(content.text) assert content.status_code == 200
def test_case_get_course_video(self): clabelid_list = dataHandler.get_clabelId_list() ctypeId = dataHandler.get_value_dict()["ctypeId"] # print(ctypeId) for clabelId in clabelid_list: label_list = [] label_list.append(clabelId) # print(label_list) customize_body = { "ctypeId": ctypeId, "labels": label_list, "pageNum": 0, "pageSize": 0, "type": 0 } api_info = Basic().get_api_by_name("get_course_video", customize_body=customize_body) # print(api_info) content = Basic().send_request(**api_info) assert content.status_code == 200
def test_case_get_course_order(self): api_info = Basic().get_api_by_name("get_mycourse_order") content = Basic().send_request(**api_info) assert content.status_code == 200 TestCourseOrderController.course_list_dict = dataHandler().str_to_dict(content.text)
def test_case_3_admin_login(self): body = {"username": "******", "password": "******"} api_info = Basic().get_api_by_name("get_admin_login", customize_body=body) content = Basic().send_request(**api_info) assert content.status_code == 200
def test_case_get_course_details(self): params = "cId="+str(GlobalConfig.cId)+"&&userId="+str(GlobalConfig.userId) api_info = Basic().get_api_by_name("get_course_details", customize_params=params) content = Basic().send_request(**api_info) assert content.status_code == 200 TestCourseController.content_dict = dataHandler().str_to_dict(content.text)# 返回内容中有需要的ctypeId和teacherId
def test_case_1_get_edu_user_info(self): api_info = Basic().get_api_by_name("get_user_list") content = Basic().send_request(**api_info) assert content.status_code == 200 #查看响应码
def test_case_2_find_advert_by_id(self): param = "advertId="+str(self.advert_id) api_info = Basic().get_api_by_name("find_advert_by_id",customize_params=param) content = Basic().send_request(**api_info) # print(content.text) assert content.status_code == 200
def test_case_2_get_teacher_by_id(self): params = "teacherId=25"#+str(self.teacher_id) api_info = Basic().get_api_by_name("get_teacher_by_id",customize_params=params) content = Basic().send_request(**api_info) # print(content.text) assert content.status_code == 200
def test_case1_get_home_page_content(self): api_info = Basic().get_api_by_name("get_home_page_content") content = Basic().send_request(**api_info) assert content.status_code == 200
def test_case_2_get_course_list_type(self): api_info = Basic().get_api_by_name("get_course_list_type") content = Basic().send_request(**api_info) # print(content.text) assert content.status_code == 200