def test_response_data_format(self): """ 用例描述:【新版儿童模式】过滤器内容接口默认参数状态码返回 :return: """ conf = Config() test = Assert.Assertions() host = conf.debug_gossapi_host api_url = host + "/child/filter/content" params = Params().encrypt_data({ "source": "iqiyi", "dockId": "1", "filters": [{ "k": "1", "v": "1" }], "page": "1", "pageSize": "10", "gender": "1", "ageDuration": "1" }) headers = conf.debug_headers res = requests.post(api_url, params=params, headers=headers) print(res.json()) schema = json.load( open(conf.json_schema_path + "/child_filter_content_schema.json")) assert test.assert_code(res.status_code, 200) assert test.assert_jsonschema(res.json(), schema)
def test_response_data_format(self): """ 用例描述:用户年级关系保存接口默认参数状态码返回 :return: """ conf = Config() test = Assert.Assertions() host = conf.debug_gossapi_host api_url = host + "/userEdu/saveUserGrade" params = Params().encrypt_data({ "openid": "ff5d5663695b00f97015588033c196c7", "gradeId": 3, "phone": "" }) headers = conf.debug_headers res = requests.post(api_url, params=params, headers=headers) schema = json.load( open(conf.json_schema_path + "/userEdu_saveUserGrade_schema.json")) json_data = res.json() assert test.assert_code(res.status_code, 200) assert test.assert_code(json_data.get("code"), 200) assert test.assert_jsonschema(json_data, schema)
def test_response_data_format(self): """ 用例描述:VIP商品二维码接口状态码返回 :return: """ conf = Config() test = Assert.Assertions() host = conf.debug_gossapi_host api_url = host + "/vip/productQrCode" params = Params().encrypt_data({ "openid": "kh54gh2j3g563gc673jh", "mobile": "15770843323", "product_id": "23", "service": "edu.pay", "from": "edu" }) headers = conf.debug_headers res = requests.post(api_url, params=params, headers=headers) schema = json.load( open(conf.json_schema_path + "/vip_product_pay_status_schema.json")) json_data = res.json() assert test.assert_code(res.status_code, 200) assert test.assert_code(json_data.get("code"), 200) assert test.assert_jsonschema(json_data, schema)
def test_response_data_format(self): """ 用例描述:图书馆标签详情接口状态码返回 :return: """ conf = Config() test = Assert.Assertions() host = conf.debug_gossapi_host api_url = host + "/library/tagDetail" params = Params().encrypt_data({ "libraryId": 4512154, "page": 1, "pageSize": 10 }) headers = conf.debug_headers res = requests.post(api_url, params=params, headers=headers) schema = json.load( open(conf.json_schema_path + "/library_tag_detail_schema.json")) json_data = res.json() assert test.assert_code(res.status_code, 200) assert test.assert_code(json_data.get("code"), 200) assert test.assert_jsonschema(json_data, schema)
def test_response_data_format(self): """ 用例描述:【新版儿童模式】获取画面静止时随机播放内容接口默认参数状态码返回和返回格式JsonSchema格式验证 :return: """ conf = Config() test = Assert.Assertions() host = conf.debug_gossapi_host api_url = host + "/child/broadcast/list" params = Params().encrypt_data({"broadcastScene": "1"}) headers = conf.debug_headers res = requests.post(api_url, params=params, headers=headers) schema = json.load( open(conf.json_schema_path + "/child_broadcast_list_schema.json")) assert test.assert_code(res.status_code, 200) assert test.assert_jsonschema(res.json(), schema)
def test_response_data_format(self): """ 用例描述:课程详情接口状态码返回 :return: """ conf = Config() test = Assert.Assertions() host = conf.debug_gossapi_host api_url = host + "/course/detail" headers = conf.debug_headers params = Params().encrypt_data({"contentId": "4512154"}) print(params) schema = json.load( open(conf.json_schema_path + "/course_detail_schema.json")) res = requests.post(api_url, params=params, headers=headers) assert test.assert_code(res.status_code, 200) assert test.assert_jsonschema(res.json(), schema)
def test_response_data_format(self): """ 用例描述:VIP商品列表接口状态码返回 :return: """ conf = Config() test = Assert.Assertions() host = conf.debug_gossapi_host api_url = host + "/vip/productList" params = Params().encrypt_data({"partner": "edu", "from": "edu"}) headers = conf.debug_headers res = requests.post(api_url, params=params, headers=headers) schema = json.load(open(conf.json_schema_path + "/vip_product_list_schema.json")) json_data = res.json() assert res.status_code == 200 assert json_data.get("code") == 200 assert test.assert_jsonschema(json_data, schema)
def test_response_data_format(self): """ 用例描述:VIP商品支付状态接口状态码返回 :return: """ conf = Config() test = Assert.Assertions() host = conf.debug_gossapi_host api_url = host + "/vip/productPayStatus" params = Params().encrypt_data({"key": None}) # TODO headers = conf.debug_headers res = requests.post(api_url, params=params, headers=headers) schema = json.load(open(conf.json_schema_path + "/vip_product_pay_status_schema.json")) json_data = res.json() assert test.assert_code(res.status_code, 200) assert test.assert_code(json_data.get("code"), 200) assert test.assert_jsonschema(json_data, schema)
def test_response_data_format(self): """ 用例描述:课程表/单课件专题详情接口返回状态码 :return: """ conf = Config() test = Assert.Assertions() host = conf.debug_gossapi_host api_url = host + "/course/seminarDetail" params = Params().encrypt_data({"contentId": "4512154"}) headers = conf.debug_headers res = requests.post(api_url, params=params, headers=headers) schema = json.load( open(conf.json_schema_path + "/course_seminar_detail_schema.json")) json_data = res.json() assert test.assert_code(res.status_code, 200) assert test.assert_code(json_data.get("code"), 200) assert test.assert_jsonschema(json_data, schema)
def test_response_data_format(self): """ 用例描述:课程/课程表配置查询接口默认参数状态码返回和返回格式JsonSchema格式验证 :return: """ conf = Config() test = Assert.Assertions() host = conf.debug_goss_host api_url = host + "/api/v1/launcher/isConfig" headers = conf.debug_headers params = Params().non_encrypted_data({ 'sourceId': '10001', 'sourceType': 2 }) res = requests.post(api_url, params=params, headers=headers) schema = json.load( open(conf.json_schema_path + "/launcher_is_config_schema.json")) assert test.assert_code(res.status_code, 200) assert test.assert_jsonschema(res.json(), schema)
def test_response_data_format(self): """ 用例描述:用户教育会员信息接口状态码返回 :return: """ conf = Config() test = Assert.Assertions() host = conf.debug_gossapi_host api_url = host + "/userEdu/info" params = Params().encrypt_data( {"openid": "8c3484c9889525d2edb171b996686ecd"}) headers = conf.debug_headers schema = json.load( open(conf.json_schema_path + "/user_edu_info_schema.json")) res = requests.post(api_url, params=params, headers=headers) json_data = res.json() assert test.assert_code(res.status_code, 200) assert test.assert_code(json_data.get("code"), 200) assert test.assert_jsonschema(json_data, schema)
def test_response_data_format(self): """ 用例描述:播放地址接口默认参数状态码返回 :return: """ conf = Config() test = Assert.Assertions() host = conf.debug_gossapi_host api_url = host + "/course/playAddress" headers = conf.debug_headers params = Params().encrypt_data({ "openId": "8c3484c9889525d2edb171b996686ecd", "coursewareId": "451511" }) res = requests.post(api_url, params=params, headers=headers) schema = json.load( open(conf.json_schema_path + "/course_playAddress_schema.json")) json_data = res.json() assert test.assert_code(res.status_code, 200) assert test.assert_code(json_data.get("code"), 200) assert test.assert_jsonschema(json_data, schema)
def test_response_data_format(self): """ 用例描述:【新版儿童模式】语音搜索接口默认参数状态码返回 :return: """ conf = Config() test = Assert.Assertions() host = conf.debug_gossapi_host api_url = host + "/child/voice/search" headers = conf.debug_headers params = Params().encrypt_data({ "film": "小猪佩奇", "filmType": "动画片", "fileSubType": "开心", "filmTag": "动作", "filmLanguage": "英语", "filmArea": "美国", "newest": "1", "hottest": "1", "highScore": "1", "gender": "1", "ageDuration": "1", "page": "1", "pageSize": "1", "uiMode": 4, "guide": "", "guideTips": "", "keyWords": "" }) res = requests.post(api_url, params=params, headers=headers) schema = json.load( open(conf.json_schema_path + "/child_voice_search_schema.json")) assert test.assert_code(res.status_code, 200) assert test.assert_jsonschema(res.json(), schema)
def test_response_data_format(self): """ 用例描述:【新版儿童模式】过滤器标签接口默认参数状态码返回和返回格式JsonSchema格式验证 :return: """ conf = Config() test = Assert.Assertions() host = conf.debug_gossapi_host api_url = host + "/child/filter/tags" params = Params().encrypt_data({ "source": "iqiyi", "dockId": "1", "gender": "1", "ageDuration": "1" }) headers = conf.debug_headers res = requests.post(api_url, params=params, headers=headers) schema = json.load( open(conf.json_schema_path + "/child_filter_tags_schema.json")) assert test.assert_code(res.status_code, 200) assert test.assert_jsonschema(res.json(), schema)