def test_test_issuance_plan10(): '''发行计划''' url = "https://testapi.huxin315.com/cloud-service/api/merchant/insertProject" headers = { # 设置http头部信息 'Host': 'testapi.huxin315.com', 'Authorization':'eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiJ9.eyJleHAiOjE2MTQyMzIwNjgsInVzZXJJZCI6Iklnbjd1aGZtcUV6ZkxsQmtoWENGNVI5cUc0c3lpWTNpU1dPWlpRbURENkkramJkY1FRTytBV3dUM2E2a1BVN1paTVlDc291aWhtSVlQZkdjcXlyZU9iTVNFK0UwRTlFM3ZodEMxeVBoa3IyN2hnc0crMEdudnBOcmdWOEYwMm5LZEd4dS9ZNGIxT1BTQ2F5aDEvZElRRmNyS1lCM3NvZzJKdHlHN0tBQjVsbz0iLCJpYXQiOjE2MTM2MjcyNjh9.nR7Zdx1UqiMef3ZelYNBFdqrXYHJrtSf2BvLFvWCUBwMgVHTBUzyNxiBlefJz2tspRInf4QVRH78UfEmxIhwwfy3B7v325mLYZnKTC1qfvG_U2P8l0JK_ew85yu5uDpUd1VijjpVUk4TXITmUmQlSInTm4YPjvSom0mVD-omOfqnk1k0gAXUGuNW6CFOERQs-ISrIm6k4P5BMvlDVUK9Z6RdDFNA5OddoU66ltTdhBo7PbGzhnzRJZ5T1Jiem4xvL3FtACCDRIlWcTj6MTXH4qrLAe6MwS9jpGYxSqRCHdYpAR6MqnNRAhtIkFhvKPiZnX5M0CFZlYPBYYPJfwGwmA', 'Content-Type': 'application/json;charset=UTF-8' } params='{"yfsProject":{"entId":"d946d4eb4c6662628ddb21f3ff10729f","proName":"【测试计划A】","startTime":1613577600000,"endTime":1646063999000,"serverStopTime":1646036784901,"joinIns":true,"isVoucher":false,"isDis":false,"prepaidLimit":"10","consume":3,"productForm":0,"useScope":0,"registered":0,"phoneNumbers":"jCOspwyLYVAJE9YCV9VXn0ORuLMSIgp/+84PI9Vs7umKHCl9wg/BebSeec/+I3Gb/U59SPVTGzRg8izgrwMSkvCIPAMRMlAkuXus/fBBVe3rT4Ayjltg0VitwBMTRlFyfvlTaGqGSH5QppBRr+Jq4GeW9sA/rfbIwd4vb5FXLDE=","verCode":"000000","proAbstract":"服务内容服务内容服务内容服务内容服务内容服务内容服务内容服务内容服务内容服务内容服务内容服务内容服务内容服务内容服务内容","shopIds":["ebb6a3c3e82d13b73f97d3f0f224ce47"],"agrId":"cf17a89f131a86b97ce329d34745fa10","totalPri":"1000","lastUpdateTime":"2021-02-18T14:31:36"},"verCode":"000000"}' send_request=interface(url,headers,params) response=send_request.send_request() response_text=response.text response_json=json.loads(response_text) api_val.reponse = response_text api_val.statue_code = response.status_code api_val.url=url api_val.request=params print(response_text) print("###########",api_val.url) msg = response_json["msg"] code = response_json["code"] code_str=str(code) assert response.status_code == 200 assert code_str != '0' assert code_str[0] !='3' #3xx-重定向:客户端浏览器必须采取更多操作来实现请求。 assert code_str[0] != '4' #4xx-客户端错误:发生错误,客户端似乎有问题。 assert code_str[0] != '5' #5xx-服务器错误:服务器由于遇到错误而不能完成该请求。
def test_test_issuance_plan2(): '''发行计划''' url = "https://testapi.huxin315.com/cloud-service/api/enterprise/selectByUser" headers = { # 设置http头部信息 'Host': 'testapi.huxin315.com', 'Authorization':'eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiJ9.eyJleHAiOjE2MTQyMzIwNjgsInVzZXJJZCI6Iklnbjd1aGZtcUV6ZkxsQmtoWENGNVI5cUc0c3lpWTNpU1dPWlpRbURENkkramJkY1FRTytBV3dUM2E2a1BVN1paTVlDc291aWhtSVlQZkdjcXlyZU9iTVNFK0UwRTlFM3ZodEMxeVBoa3IyN2hnc0crMEdudnBOcmdWOEYwMm5LZEd4dS9ZNGIxT1BTQ2F5aDEvZElRRmNyS1lCM3NvZzJKdHlHN0tBQjVsbz0iLCJpYXQiOjE2MTM2MjcyNjh9.nR7Zdx1UqiMef3ZelYNBFdqrXYHJrtSf2BvLFvWCUBwMgVHTBUzyNxiBlefJz2tspRInf4QVRH78UfEmxIhwwfy3B7v325mLYZnKTC1qfvG_U2P8l0JK_ew85yu5uDpUd1VijjpVUk4TXITmUmQlSInTm4YPjvSom0mVD-omOfqnk1k0gAXUGuNW6CFOERQs-ISrIm6k4P5BMvlDVUK9Z6RdDFNA5OddoU66ltTdhBo7PbGzhnzRJZ5T1Jiem4xvL3FtACCDRIlWcTj6MTXH4qrLAe6MwS9jpGYxSqRCHdYpAR6MqnNRAhtIkFhvKPiZnX5M0CFZlYPBYYPJfwGwmA', 'Content-Type': 'application/json;charset=UTF-8' } params='{"pageNum":2,"authState":1}' send_request=interface(url,headers,params) response=send_request.send_request() response_text=response.text response_json=json.loads(response_text) api_val.reponse = response_text api_val.statue_code = response.status_code api_val.url=url api_val.request=params print(response_text) print("###########",api_val.url) msg = response_json["msg"] code = response_json["code"] code_str=str(code) assert response.status_code == 200 assert code_str != '0' assert code_str[0] !='3' #3xx-重定向:客户端浏览器必须采取更多操作来实现请求。 assert code_str[0] != '4' #4xx-客户端错误:发生错误,客户端似乎有问题。 assert code_str[0] != '5' #5xx-服务器错误:服务器由于遇到错误而不能完成该请求。
def test_api(): url = "https://testapi.huxin315.com//cloud-service/api/merchant/myProject" headers = { # 设置http头部信息 'Host': 'testapi.huxin315.com', 'Authorization': 'eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiJ9.eyJleHAiOjE3MDIyODc4NTMsInVzZXJJZCI6ImJtZnk1eGFhSU1uUkdQa3dvR0VXTkNITEhmeFkyUW8wL2sxN0NwWGRLQ3dzbmc3RVhhaHdBbWlnUG5FOWl5VkF2YTBrR2NpeVQ0VjJEYTh2U20rQndzc2lxeGhQNHZXT3RnYys2VnR4Wng5TXV1a3lua29WK3FoOWhEaklGSVN3dEF0T29EL1FIV04xTGV4QnhlTForbjhEaWI1NlZ5akhGUkwzZDhEU2hlST0iLCJpYXQiOjE2MTU5NzQyNTN9.vi-vY0wEVAll1MWTZ4A5G6KKkDbnEBuDB2qZkyGc6fBcq8CzUIQiK7H5WspcQOESVYV-od9a-6-BVxGPgJDGd5zreiT--dUWoOkZ7TCq8pShIaOj1nVafKBWkMEiT5UdO4Cojmb9P0Svnmp7KltZbx43fINH4cMgBDnpGZnpcjIS_u-9vQd3ld76a4cR_adrOmr8zcJ9wcndQetaqdNmQCfbjIRqMaEPzzP2HrvfIrrK7wbitrx7F0JA6zbAEbpaR2Oa0qj-_CFQjYeNYiST7vG0Dl7LhWOJHSST5hAl8DG5HXKoBK8s1CAt1TYWcfmyi-6sZBAN_Z4ti7S5yqc-Wg', 'Content-Type': 'application/json;charset=UTF-8' } params = {"pageNum": 1} send_request = interface(url, headers, params, 'post') response = send_request.send_request() response_text = response.text response_json = json.loads(response_text) api_val.reponse = response_text api_val.statue_code = response.status_code api_val.url = url api_val.request = params print(response_text) print("###########", api_val.url) code = response_json["code"] code_str = str(code) assert response.status_code == 200 assert code_str != '0' assert code_str[0] != '3' #3xx-重定向:客户端浏览器必须采取更多操作来实现请求。 assert code_str[0] != '4' #4xx-客户端错误:发生错误,客户端似乎有问题。 assert code_str[0] != '5' #5xx-服务器错误:服务器由于遇到错误而不能完成该请求。