Exemplo n.º 1
0
 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()
Exemplo n.º 2
0
 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_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_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_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)
Exemplo n.º 6
0
    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_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_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_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_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