class Test_Bs_Top(object): def setup_class(self): # print('test start') self.session = Init.BS_SESSION self.base_info = Init.BASE_INFO self.log_info = Init.LOG_INFO self.console_host = self.base_info['bsHost'] self.workspaceId = self.base_info['ctyunAcctId'] self.log = CreateLogData() self.get_domain_list = self.log.get_bs_domain_list(self.workspaceId) # 接口 self.uri_url = self.console_host + self.log_info['ListTopUri'] self.referer_url = self.console_host + self.log_info['ListTopReferer'] self.domain_url = self.console_host + self.log_info['ListTopDomain'] self.ip_url = self.console_host + self.log_info['ListTopIp'] # 日期类 self.day_time = self.log.day_time self.yesterday_time = self.log.yesterday_time self.before_yesterday = self.log.before_yesterday self.sevenday_time = self.log.sevenday_time self.month_time = self.log.month_time self.now_time = self.log.now_time # 查询数据 self.default_uri_hit_data = { "data": { "workspaceId": self.workspaceId, "startTime": self.yesterday_time, "endTime": self.day_time, "domain": self.get_domain_list, "top": 100, "httpCode": [], "productCode": [], "status": "HIT", "sortedBy": "flow" } } self.default_uri_miss_data = { "data": { "workspaceId": self.workspaceId, "startTime": self.yesterday_time, "endTime": self.day_time, "domain": self.get_domain_list, "top": 100, "httpCode": [], "productCode": [], "status": "MISS", "sortedBy": "flow" } } self.default_referer_data = { "data": { "workspaceId": self.workspaceId, "startTime": self.yesterday_time, "endTime": self.day_time, "domain": self.get_domain_list, "top": 100, "productCode": [], "sortedBy": "flow" } } self.default_domain_data = { "data": { "workspaceId": self.workspaceId, "startTime": self.yesterday_time, "endTime": self.day_time, "domain": self.get_domain_list, "productCode": [], "sortedBy": "flow" } } self.default_ip_data = { "data": { "workspaceId": self.workspaceId, "startTime": self.yesterday_time, "endTime": self.day_time, "domain": self.get_domain_list, "top": 100, "provinceCode": [], "sortedBy": "flow" } } self.uri_hit_data_001 = { "data": { "workspaceId": self.workspaceId, "startTime": self.yesterday_time, "endTime": self.day_time, "domain": self.log.get_bs_cp_domain(self.console_host, self.workspaceId, '001'), "top": 100, "httpCode": [], "productCode": ["001"], "status": "HIT", "sortedBy": "flow" } } self.uri_miss_data_001 = { "data": { "workspaceId": self.workspaceId, "startTime": self.yesterday_time, "endTime": self.day_time, "domain": self.log.get_bs_cp_domain(self.console_host, self.workspaceId, '001'), "top": 100, "httpCode": [], "productCode": ["001"], "status": "MISS", "sortedBy": "flow" } } self.referer_data_001 = { "data": { "workspaceId": self.workspaceId, "startTime": self.yesterday_time, "endTime": self.day_time, "domain": self.log.get_bs_cp_domain(self.console_host, self.workspaceId, '001'), "top": 100, "productCode": ["001"], "sortedBy": "flow" } } self.domain_data_001 = { "data": { "workspaceId": self.workspaceId, "startTime": self.yesterday_time, "endTime": self.day_time, "domain": self.log.get_bs_cp_domain(self.console_host, self.workspaceId, '001'), "productCode": ["001"], "sortedBy": "flow" } } self.ip_data_001 = { "data": { "workspaceId": self.workspaceId, "startTime": self.yesterday_time, "endTime": self.day_time, "domain": self.log.get_bs_cp_domain(self.console_host, self.workspaceId, '001'), "top": 100, "provinceCode": ["001"], "sortedBy": "flow" } } self.uri_hit_data_003 = { "data": { "workspaceId": self.workspaceId, "startTime": self.yesterday_time, "endTime": self.day_time, "domain": self.log.get_bs_cp_domain(self.console_host, self.workspaceId, '003'), "top": 100, "httpCode": [], "productCode": ["003"], "status": "HIT", "sortedBy": "flow" } } self.uri_miss_data_003 = { "data": { "workspaceId": self.workspaceId, "startTime": self.yesterday_time, "endTime": self.day_time, "domain": self.log.get_bs_cp_domain(self.console_host, self.workspaceId, '003'), "top": 100, "httpCode": [], "productCode": ["003"], "status": "MISS", "sortedBy": "flow" } } self.referer_data_003 = { "data": { "workspaceId": self.workspaceId, "startTime": self.yesterday_time, "endTime": self.day_time, "domain": self.log.get_bs_cp_domain(self.console_host, self.workspaceId, '003'), "top": 100, "productCode": ["003"], "sortedBy": "flow" } } self.domain_data_003 = { "data": { "workspaceId": self.workspaceId, "startTime": self.yesterday_time, "endTime": self.day_time, "domain": self.log.get_bs_cp_domain(self.console_host, self.workspaceId, '003'), "productCode": ["003"], "sortedBy": "flow" } } self.ip_data_003 = { "data": { "workspaceId": self.workspaceId, "startTime": self.yesterday_time, "endTime": self.day_time, "domain": self.log.get_bs_cp_domain(self.console_host, self.workspaceId, '003'), "top": 100, "provinceCode": ["003"], "sortedBy": "flow" } } self.uri_hit_data_004 = { "data": { "workspaceId": self.workspaceId, "startTime": self.yesterday_time, "endTime": self.day_time, "domain": self.log.get_bs_cp_domain(self.console_host, self.workspaceId, '003'), "top": 100, "httpCode": [], "productCode": ["004"], "status": "HIT", "sortedBy": "flow" } } self.uri_miss_data_004 = { "data": { "workspaceId": self.workspaceId, "startTime": self.yesterday_time, "endTime": self.day_time, "domain": self.log.get_bs_cp_domain(self.console_host, self.workspaceId, '004'), "top": 100, "httpCode": [], "productCode": ["004"], "status": "MISS", "sortedBy": "flow" } } self.referer_data_004 = { "data": { "workspaceId": self.workspaceId, "startTime": self.yesterday_time, "endTime": self.day_time, "domain": self.log.get_bs_cp_domain(self.console_host, self.workspaceId, '004'), "top": 100, "productCode": ["004"], "sortedBy": "flow" } } self.domain_data_004 = { "data": { "workspaceId": self.workspaceId, "startTime": self.yesterday_time, "endTime": self.day_time, "domain": self.log.get_bs_cp_domain(self.console_host, self.workspaceId, '004'), "productCode": ["004"], "sortedBy": "flow" } } self.ip_data_004 = { "data": { "workspaceId": self.workspaceId, "startTime": self.yesterday_time, "endTime": self.day_time, "domain": self.log.get_bs_cp_domain(self.console_host, self.workspaceId, '004'), "top": 100, "provinceCode": ["004"], "sortedBy": "flow" } } self.uri_hit_data_005 = { "data": { "workspaceId": self.workspaceId, "startTime": self.yesterday_time, "endTime": self.day_time, "domain": self.log.get_bs_cp_domain(self.console_host, self.workspaceId, '005'), "top": 100, "httpCode": [], "productCode": ["005"], "status": "HIT", "sortedBy": "flow" } } self.uri_miss_data_005 = { "data": { "workspaceId": self.workspaceId, "startTime": self.yesterday_time, "endTime": self.day_time, "domain": self.log.get_bs_cp_domain(self.console_host, self.workspaceId, '005'), "top": 100, "httpCode": [], "productCode": ["005"], "status": "MISS", "sortedBy": "flow" } } self.referer_data_005 = { "data": { "workspaceId": self.workspaceId, "startTime": self.yesterday_time, "endTime": self.day_time, "domain": self.log.get_bs_cp_domain(self.console_host, self.workspaceId, '005'), "top": 100, "productCode": ["005"], "sortedBy": "flow" } } self.domain_data_005 = { "data": { "workspaceId": self.workspaceId, "startTime": self.yesterday_time, "endTime": self.day_time, "domain": self.log.get_bs_cp_domain(self.console_host, self.workspaceId, '005'), "productCode": ["005"], "sortedBy": "flow" } } self.ip_data_005 = { "data": { "workspaceId": self.workspaceId, "startTime": self.yesterday_time, "endTime": self.day_time, "domain": self.log.get_bs_cp_domain(self.console_host, self.workspaceId, '005'), "top": 100, "provinceCode": ["005"], "sortedBy": "flow" } } self.uri_hit_httpcode_data = { "data": { "workspaceId": self.workspaceId, "startTime": self.yesterday_time, "endTime": self.day_time, "domain": self.get_domain_list, "top": 100, "httpCode": [random.choice(httpCode)], "productCode": [], "status": "HIT", "sortedBy": "flow" } } self.uri_miss_httpcode_data = { "data": { "workspaceId": self.workspaceId, "startTime": self.yesterday_time, "endTime": self.day_time, "domain": self.get_domain_list, "top": 100, "httpCode": [random.choice(httpCode)], "productCode": [], "status": "MISS", "sortedBy": "flow" } } self.uri_hit_request_data = { "data": { "workspaceId": self.workspaceId, "startTime": self.yesterday_time, "endTime": self.day_time, "domain": self.get_domain_list, "top": 100, "httpCode": [], "productCode": [], "status": "HIT", "sortedBy": "request" } } self.uri_miss_request_data = { "data": { "workspaceId": self.workspaceId, "startTime": self.yesterday_time, "endTime": self.day_time, "domain": self.get_domain_list, "top": 100, "httpCode": [], "productCode": [], "status": "MISS", "sortedBy": "request" } } self.referer_request_data = { "data": { "workspaceId": self.workspaceId, "startTime": self.yesterday_time, "endTime": self.day_time, "domain": self.get_domain_list, "top": 100, "productCode": [], "sortedBy": "request" } } self.domain_request_data = { "data": { "workspaceId": self.workspaceId, "startTime": self.yesterday_time, "endTime": self.day_time, "domain": self.get_domain_list, "productCode": [], "sortedBy": "request" } } self.ip_request_data = { "data": { "workspaceId": self.workspaceId, "startTime": self.yesterday_time, "endTime": self.day_time, "domain": self.get_domain_list, "top": 100, "provinceCode": [], "sortedBy": "request" } } self.ip_province_data = { "data": { "workspaceId": self.workspaceId, "startTime": self.yesterday_time, "endTime": self.day_time, "domain": self.get_domain_list, "top": 100, "provinceCode": [random.choice(province)], "sortedBy": "request" } } self.today_uri_hit_data = { "data": { "workspaceId": self.workspaceId, "startTime": self.day_time, "endTime": self.now_time, "domain": self.get_domain_list, "top": 100, "httpCode": [], "productCode": [], "status": "HIT", "sortedBy": "flow" } } self.today_uri_miss_data = { "data": { "workspaceId": self.workspaceId, "startTime": self.day_time, "endTime": self.now_time, "domain": self.get_domain_list, "top": 100, "httpCode": [], "productCode": [], "status": "MISS", "sortedBy": "flow" } } self.today_referer_data = { "data": { "workspaceId": self.workspaceId, "startTime": self.day_time, "endTime": self.now_time, "domain": self.get_domain_list, "top": 100, "productCode": [], "sortedBy": "flow" } } self.today_domain_data = { "data": { "workspaceId": self.workspaceId, "startTime": self.day_time, "endTime": self.now_time, "domain": self.get_domain_list, "productCode": [], "sortedBy": "flow" } } self.today_ip_data = { "data": { "workspaceId": self.workspaceId, "startTime": self.day_time, "endTime": self.now_time, "domain": self.get_domain_list, "top": 100, "provinceCode": [], "sortedBy": "flow" } } self.seven_domain_data = { "data": { "workspaceId": self.workspaceId, "startTime": self.sevenday_time, "endTime": self.now_time, "domain": self.get_domain_list, "productCode": [], "sortedBy": "flow" } } self.senven_ip_data = { "data": { "workspaceId": self.workspaceId, "startTime": self.sevenday_time, "endTime": self.now_time, "domain": self.get_domain_list, "top": 100, "provinceCode": [], "sortedBy": "flow" } } self.month_domain_data = { "data": { "workspaceId": self.workspaceId, "startTime": self.month_time, "endTime": self.now_time, "domain": self.get_domain_list, "productCode": [], "sortedBy": "flow" } } self.month_ip_data = { "data": { "workspaceId": self.workspaceId, "startTime": self.month_time, "endTime": self.now_time, "domain": self.get_domain_list, "top": 100, "provinceCode": [], "sortedBy": "flow" } } def teardown_class(self): # 做清数据,退出登录等 self.session.close() print('-------------------test end-------------------') @allure.story("默认查询热门URL") def test_CDN_251576(self): url = self.uri_url payload = self.default_uri_hit_data response = self.session.post(url, json=payload, timeout=10) print("-------------------查询 topuri 接口-------------------") print('请求url: ' + url) print("请求data: " + str(payload)) print("返回: " + response.text) print("重点验证:" " expect: 返回码与响应时间") assert response.status_code == 200 assert 'core.ok' in response.text assert response.elapsed.total_seconds() < 3 @allure.story("默认查询热门URL(回源)") def test_CDN_251577(self): url = self.uri_url payload = self.default_uri_miss_data response = self.session.post(url, json=payload, timeout=10) print("-------------------查询 topuri 接口-------------------") print('请求url: ' + url) print("请求data: " + str(payload)) print("返回: " + response.text) print("重点验证:" " expect: 返回码与响应时间") assert response.status_code == 200 assert 'core.ok' in response.text assert response.elapsed.total_seconds() < 3 @allure.story("默认查询热门Referer") def test_CDN_251578(self): url = self.referer_url payload = self.default_referer_data response = self.session.post(url, json=payload, timeout=10) print("-------------------查询 topreferer 接口-------------------") print('请求url: ' + url) print("请求data: " + str(payload)) print("返回: " + response.text) print("重点验证:" " expect: 返回码与响应时间") assert response.status_code == 200 assert 'core.ok' in response.text assert response.elapsed.total_seconds() < 3 @allure.story("默认查询域名排行") def test_CDN_251579(self): url = self.domain_url payload = self.default_domain_data response = self.session.post(url, json=payload, timeout=10) print("-------------------查询 topdomain 接口-------------------") print('请求url: ' + url) print("请求data: " + str(payload)) print("返回: " + response.text) print("重点验证:" " expect: 返回码与响应时间") assert response.status_code == 200 assert 'core.ok' in response.text assert response.elapsed.total_seconds() < 3 @allure.story("默认查询TOP客户端IP") def test_CDN_251580(self): url = self.ip_url payload = self.default_ip_data response = self.session.post(url, json=payload, timeout=10) print("-------------------查询 topip 接口-------------------") print('请求url: ' + url) print("请求data: " + str(payload)) print("返回: " + response.text) print("重点验证:" " expect: 返回码与响应时间") assert response.status_code == 200 assert 'core.ok' in response.text assert response.elapsed.total_seconds() < 3 @allure.story("静态加速产品下查询热门URL") def test_CDN_251581(self): url = self.uri_url payload = self.uri_hit_data_001 response = self.session.post(url, json=payload, timeout=10) print("-------------------查询 topuri 接口-------------------") print('请求url: ' + url) print("请求data: " + str(payload)) print("返回: " + response.text) print("重点验证:" " expect: 返回码与响应时间") assert response.status_code == 200 assert 'core.ok' in response.text assert response.elapsed.total_seconds() < 3 @allure.story("静态加速产品下查询热门URL(回源)") def test_CDN_251582(self): url = self.uri_url payload = self.uri_miss_data_001 response = self.session.post(url, json=payload, timeout=10) print("-------------------查询 topuri 接口-------------------") print('请求url: ' + url) print("请求data: " + str(payload)) print("返回: " + response.text) print("重点验证:" " expect: 返回码与响应时间") assert response.status_code == 200 assert 'core.ok' in response.text assert response.elapsed.total_seconds() < 3 @allure.story("静态加速产品下查询热门Referer") def test_CDN_251583(self): url = self.referer_url payload = self.referer_data_001 response = self.session.post(url, json=payload, timeout=10) print("-------------------查询 topreferer 接口-------------------") print('请求url: ' + url) print("请求data: " + str(payload)) print("返回: " + response.text) print("重点验证:" " expect: 返回码与响应时间") assert response.status_code == 200 assert 'core.ok' in response.text assert response.elapsed.total_seconds() < 3 @allure.story("静态加速产品下查询域名排行") def test_CDN_251584(self): url = self.domain_url payload = self.domain_data_001 response = self.session.post(url, json=payload, timeout=10) print("-------------------查询 topdomain 接口-------------------") print('请求url: ' + url) print("请求data: " + str(payload)) print("返回: " + response.text) print("重点验证:" " expect: 返回码与响应时间") assert response.status_code == 200 assert 'core.ok' in response.text assert response.elapsed.total_seconds() < 3 @allure.story("静态加速产品下查询TOP客户端IP") def test_CDN_251585(self): url = self.ip_url payload = self.ip_data_001 response = self.session.post(url, json=payload, timeout=10) print("-------------------查询 topip 接口-------------------") print('请求url: ' + url) print("请求data: " + str(payload)) print("返回: " + response.text) print("重点验证:" " expect: 返回码与响应时间") assert response.status_code == 200 assert 'core.ok' in response.text assert response.elapsed.total_seconds() < 3 @allure.story("下载加速产品下查询热门URL") def test_CDN_251586(self): url = self.uri_url payload = self.uri_hit_data_003 response = self.session.post(url, json=payload, timeout=10) print("-------------------查询 topuri 接口-------------------") print('请求url: ' + url) print("请求data: " + str(payload)) print("返回: " + response.text) print("重点验证:" " expect: 返回码与响应时间") assert response.status_code == 200 assert 'core.ok' in response.text assert response.elapsed.total_seconds() < 3 @allure.story("下载加速产品下查询热门URL(回源)") def test_CDN_251587(self): url = self.uri_url payload = self.uri_miss_data_003 response = self.session.post(url, json=payload, timeout=10) print("-------------------查询 topuri 接口-------------------") print('请求url: ' + url) print("请求data: " + str(payload)) print("返回: " + response.text) print("重点验证:" " expect: 返回码与响应时间") assert response.status_code == 200 assert 'core.ok' in response.text assert response.elapsed.total_seconds() < 3 @allure.story("下载加速产品下查询热门Referer") def test_CDN_251588(self): url = self.referer_url payload = self.referer_data_003 response = self.session.post(url, json=payload, timeout=10) print("-------------------查询 topreferer 接口-------------------") print('请求url: ' + url) print("请求data: " + str(payload)) print("返回: " + response.text) print("重点验证:" " expect: 返回码与响应时间") assert response.status_code == 200 assert 'core.ok' in response.text assert response.elapsed.total_seconds() < 3 @allure.story("下载加速产品下查询域名排行") def test_CDN_251589(self): url = self.domain_url payload = self.domain_data_003 response = self.session.post(url, json=payload, timeout=10) print("-------------------查询 topdomain 接口-------------------") print('请求url: ' + url) print("请求data: " + str(payload)) print("返回: " + response.text) print("重点验证:" " expect: 返回码与响应时间") assert response.status_code == 200 assert 'core.ok' in response.text assert response.elapsed.total_seconds() < 3 @allure.story("下载加速产品下查询TOP客户端IP") def test_CDN_251590(self): url = self.ip_url payload = self.ip_data_003 response = self.session.post(url, json=payload, timeout=10) print("-------------------查询 topip 接口-------------------") print('请求url: ' + url) print("请求data: " + str(payload)) print("返回: " + response.text) print("重点验证:" " expect: 返回码与响应时间") assert response.status_code == 200 assert 'core.ok' in response.text assert response.elapsed.total_seconds() < 3 @allure.story("视频点播加速产品下查询热门URL") def test_CDN_251591(self): url = self.uri_url payload = self.uri_hit_data_004 response = self.session.post(url, json=payload, timeout=10) print("-------------------查询 topuri 接口-------------------") print('请求url: ' + url) print("请求data: " + str(payload)) print("返回: " + response.text) print("重点验证:" " expect: 返回码与响应时间") assert response.status_code == 200 assert 'core.ok' in response.text assert response.elapsed.total_seconds() < 3 @allure.story("视频点播加速产品下查询热门URL(回源)") def test_CDN_251592(self): url = self.uri_url payload = self.uri_miss_data_004 response = self.session.post(url, json=payload, timeout=10) print("-------------------查询 topuri 接口-------------------") print('请求url: ' + url) print("请求data: " + str(payload)) print("返回: " + response.text) print("重点验证:" " expect: 返回码与响应时间") assert response.status_code == 200 assert 'core.ok' in response.text assert response.elapsed.total_seconds() < 3 @allure.story("视频点播加速产品下查询Referer") def test_CDN_251593(self): url = self.referer_url payload = self.referer_data_004 response = self.session.post(url, json=payload, timeout=10) print("-------------------查询 topreferer 接口-------------------") print('请求url: ' + url) print("请求data: " + str(payload)) print("返回: " + response.text) print("重点验证:" " expect: 返回码与响应时间") assert response.status_code == 200 assert 'core.ok' in response.text assert response.elapsed.total_seconds() < 3 @allure.story("视频点播加速产品下查询域名排行") def test_CDN_251594(self): url = self.domain_url payload = self.domain_data_004 response = self.session.post(url, json=payload, timeout=10) print("-------------------查询 topdomain 接口-------------------") print('请求url: ' + url) print("请求data: " + str(payload)) print("返回: " + response.text) print("重点验证:" " expect: 返回码与响应时间") assert response.status_code == 200 assert 'core.ok' in response.text assert response.elapsed.total_seconds() < 3 @allure.story("视频点播加速产品下查询TOP客户端IP") def test_CDN_251595(self): url = self.ip_url payload = self.ip_data_004 response = self.session.post(url, json=payload, timeout=10) print("-------------------查询 topip 接口-------------------") print('请求url: ' + url) print("请求data: " + str(payload)) print("返回: " + response.text) print("重点验证:" " expect: 返回码与响应时间") assert response.status_code == 200 assert 'core.ok' in response.text assert response.elapsed.total_seconds() < 3 @allure.story("视频直播加速产品下查询热门URL") def test_CDN_251596(self): url = self.uri_url payload = self.uri_hit_data_005 response = self.session.post(url, json=payload, timeout=10) print("-------------------查询 topuri 接口-------------------") print('请求url: ' + url) print("请求data: " + str(payload)) print("返回: " + response.text) print("重点验证:" " expect: 返回码与响应时间") assert response.status_code == 200 assert 'core.ok' in response.text assert response.elapsed.total_seconds() < 3 @allure.story("视频直播加速产品下查询热门URL(回源)") def test_CDN_251597(self): url = self.uri_url payload = self.uri_miss_data_005 response = self.session.post(url, json=payload, timeout=10) print("-------------------查询 topuri 接口-------------------") print('请求url: ' + url) print("请求data: " + str(payload)) print("返回: " + response.text) print("重点验证:" " expect: 返回码与响应时间") assert response.status_code == 200 assert 'core.ok' in response.text assert response.elapsed.total_seconds() < 3 @allure.story("视频直播加速产品下查询Referer") def test_CDN_251598(self): url = self.referer_url payload = self.referer_data_005 response = self.session.post(url, json=payload, timeout=10) print("-------------------查询 topreferer 接口-------------------") print('请求url: ' + url) print("请求data: " + str(payload)) print("返回: " + response.text) print("重点验证:" " expect: 返回码与响应时间") assert response.status_code == 200 assert 'core.ok' in response.text assert response.elapsed.total_seconds() < 3 @allure.story("视频直播加速产品下查询域名排行") def test_CDN_251599(self): url = self.domain_url payload = self.domain_data_005 response = self.session.post(url, json=payload, timeout=10) print("-------------------查询 topdomain 接口-------------------") print('请求url: ' + url) print("请求data: " + str(payload)) print("返回: " + response.text) print("重点验证:" " expect: 返回码与响应时间") assert response.status_code == 200 assert 'core.ok' in response.text assert response.elapsed.total_seconds() < 3 @allure.story("视频直播加速产品下查询TOP客户端IP") def test_CDN_251600(self): url = self.ip_url payload = self.ip_data_005 response = self.session.post(url, json=payload, timeout=10) print("-------------------查询 topip 接口-------------------") print('请求url: ' + url) print("请求data: " + str(payload)) print("返回: " + response.text) print("重点验证:" " expect: 返回码与响应时间") assert response.status_code == 200 assert 'core.ok' in response.text assert response.elapsed.total_seconds() < 3 @allure.story("状态码查询热门URL") def test_CDN_251601(self): url = self.uri_url payload = self.uri_hit_httpcode_data response = self.session.post(url, json=payload, timeout=10) print("-------------------查询 topuri 接口-------------------") print('请求url: ' + url) print("请求data: " + str(payload)) print("返回: " + response.text) print("重点验证:" " expect: 返回码与响应时间") assert response.status_code == 200 assert 'core.ok' in response.text assert response.elapsed.total_seconds() < 3 @allure.story("状态码查询热门URL(回源)") def test_CDN_251602(self): url = self.uri_url payload = self.uri_miss_httpcode_data response = self.session.post(url, json=payload, timeout=10) print("-------------------查询 topuri 接口-------------------") print('请求url: ' + url) print("请求data: " + str(payload)) print("返回: " + response.text) print("重点验证:" " expect: 返回码与响应时间") assert response.status_code == 200 assert 'core.ok' in response.text assert response.elapsed.total_seconds() < 3 @allure.story("访问次数维度查询热门URL") def test_CDN_251603(self): url = self.uri_url payload = self.uri_hit_request_data response = self.session.post(url, json=payload, timeout=10) print("-------------------查询 topuri 接口-------------------") print('请求url: ' + url) print("请求data: " + str(payload)) print("返回: " + response.text) print("重点验证:" " expect: 返回码与响应时间") assert response.status_code == 200 assert 'core.ok' in response.text assert response.elapsed.total_seconds() < 3 @allure.story("访问次数维度查询热门URL(回源)") def test_CDN_251604(self): url = self.uri_url payload = self.uri_miss_request_data response = self.session.post(url, json=payload, timeout=10) print("-------------------查询 topuri 接口-------------------") print('请求url: ' + url) print("请求data: " + str(payload)) print("返回: " + response.text) print("重点验证:" " expect: 返回码与响应时间") assert response.status_code == 200 assert 'core.ok' in response.text assert response.elapsed.total_seconds() < 3 @allure.story("访问次数维度查询热门Referer") def test_CDN_251605(self): url = self.referer_url payload = self.referer_request_data response = self.session.post(url, json=payload, timeout=10) print("-------------------查询 topreferer 接口-------------------") print('请求url: ' + url) print("请求data: " + str(payload)) print("返回: " + response.text) print("重点验证:" " expect: 返回码与响应时间") assert response.status_code == 200 assert 'core.ok' in response.text assert response.elapsed.total_seconds() < 3 @allure.story("访问次数维度查询域名排行") def test_CDN_251606(self): url = self.domain_url payload = self.domain_request_data response = self.session.post(url, json=payload, timeout=10) print("-------------------查询 topdomain 接口-------------------") print('请求url: ' + url) print("请求data: " + str(payload)) print("返回: " + response.text) print("重点验证:" " expect: 返回码与响应时间") assert response.status_code == 200 assert 'core.ok' in response.text assert response.elapsed.total_seconds() < 3 @allure.story("访问次数维度查询TOP客户端IP") def test_CDN_251607(self): url = self.ip_url payload = self.ip_request_data response = self.session.post(url, json=payload, timeout=10) print("-------------------查询 topip 接口-------------------") print('请求url: ' + url) print("请求data: " + str(payload)) print("返回: " + response.text) print("重点验证:" " expect: 返回码与响应时间") assert response.status_code == 200 assert 'core.ok' in response.text assert response.elapsed.total_seconds() < 3 @allure.story("通过地区查询TOP客户端IP") def test_CDN_251608(self): url = self.ip_url payload = self.ip_province_data response = self.session.post(url, json=payload, timeout=10) print("-------------------查询 topip 接口-------------------") print('请求url: ' + url) print("请求data: " + str(payload)) print("返回: " + response.text) print("重点验证:" " expect: 返回码与响应时间") assert response.status_code == 200 assert 'core.ok' in response.text assert response.elapsed.total_seconds() < 3 @allure.story("查询今天的热门URL") def test_CDN_251609(self): url = self.uri_url payload = self.today_uri_hit_data response = self.session.post(url, json=payload, timeout=10) print("-------------------查询 topuri 接口-------------------") print('请求url: ' + url) print("请求data: " + str(payload)) print("返回: " + response.text) print("重点验证:" " expect: 返回码与响应时间") assert response.status_code == 200 assert 'core.ok' in response.text assert response.elapsed.total_seconds() < 3 @allure.story("查询今天的热门URL(回源)") def test_CDN_251610(self): url = self.uri_url payload = self.today_uri_miss_data response = self.session.post(url, json=payload, timeout=10) print("-------------------查询 topuri 接口-------------------") print('请求url: ' + url) print("请求data: " + str(payload)) print("返回: " + response.text) print("重点验证:" " expect: 返回码与响应时间") assert response.status_code == 200 assert 'core.ok' in response.text assert response.elapsed.total_seconds() < 3 @allure.story("查询今天的热门Referer") def test_CDN_251611(self): url = self.referer_url payload = self.today_referer_data response = self.session.post(url, json=payload, timeout=10) print("-------------------查询 topreferer 接口-------------------") print('请求url: ' + url) print("请求data: " + str(payload)) print("返回: " + response.text) print("重点验证:" " expect: 返回码与响应时间") assert response.status_code == 200 assert 'core.ok' in response.text assert response.elapsed.total_seconds() < 3 @allure.story("查询今天的域名排行") def test_CDN_251612(self): url = self.domain_url payload = self.today_domain_data response = self.session.post(url, json=payload, timeout=10) print("-------------------查询 topdomain 接口-------------------") print('请求url: ' + url) print("请求data: " + str(payload)) print("返回: " + response.text) print("重点验证:" " expect: 返回码与响应时间") assert response.status_code == 200 assert 'core.ok' in response.text assert response.elapsed.total_seconds() < 3 @allure.story("查询今天的TOP客户端IP") def test_CDN_251613(self): url = self.ip_url payload = self.today_ip_data response = self.session.post(url, json=payload, timeout=10) print("-------------------查询 topip 接口-------------------") print('请求url: ' + url) print("请求data: " + str(payload)) print("返回: " + response.text) print("重点验证:" " expect: 返回码与响应时间") assert response.status_code == 200 assert 'core.ok' in response.text assert response.elapsed.total_seconds() < 3 @allure.story("查询7天的域名排行") def test_CDN_251614(self): url = self.domain_url payload = self.seven_domain_data response = self.session.post(url, json=payload, timeout=10) print("-------------------查询 topdomain 接口-------------------") print('请求url: ' + url) print("请求data: " + str(payload)) print("返回: " + response.text) print("重点验证:" " expect: 返回码与响应时间") assert response.status_code == 200 assert 'core.ok' in response.text assert response.elapsed.total_seconds() < 3 @allure.story("查询7天的TOP客户端IP") def test_CDN_251615(self): url = self.ip_url payload = self.senven_ip_data response = self.session.post(url, json=payload, timeout=10) print("-------------------查询 topip 接口-------------------") print('请求url: ' + url) print("请求data: " + str(payload)) print("返回: " + response.text) print("重点验证:" " expect: 返回码与响应时间") assert response.status_code == 200 assert 'core.ok' in response.text assert response.elapsed.total_seconds() < 3 # @pytest.mark.skip("响应超时") # 跳过该测试 @allure.story("查询30天的域名排行") def test_CDN_251616(self): url = self.domain_url payload = self.month_domain_data response = self.session.post(url, json=payload, timeout=10) print("-------------------查询 topdomain 接口-------------------") print('请求url: ' + url) print("请求data: " + str(payload)) print("返回: " + response.text) print("重点验证:" " expect: 返回码与响应时间") assert response.status_code == 200 assert 'core.ok' in response.text assert response.elapsed.total_seconds() < 10 # @pytest.mark.skip("响应超时") # 跳过该测试 @allure.story("查询30天的TOP客户端IP") def test_CDN_251617(self): url = self.ip_url payload = self.month_ip_data response = self.session.post(url, json=payload, timeout=10) print("-------------------查询 topip 接口-------------------") print('请求url: ' + url) print("请求data: " + str(payload)) print("返回: " + response.text) print("重点验证:" " expect: 返回码与响应时间") assert response.status_code == 200 assert 'core.ok' in response.text assert response.elapsed.total_seconds() < 10
class Test_BS_Log_dataList(): def setup_class(self): # print('test start') self.session = Init.BS_SESSION self.base_info = Init.BASE_INFO self.log_info = Init.LOG_INFO self.console_host = self.base_info['bsHost'] self.workspaceId = self.base_info['ctyunAcctId'] self.log = CreateLogData() self.get_domain_list = self.log.get_bs_domain_list(self.workspaceId) # 接口 self.fbrData_url = self.console_host + self.log_info['fbrData'] self.ispList_url = self.console_host + self.log_info['ispList'] # 日期类 self.day_time = self.log.day_time self.yesterday_time = self.log.yesterday_time self.sevenday_time = self.log.sevenday_time self.month_time = self.log.month_time self.now_time = self.log.now_time # 查询数据 self.default_data = { "data": { "workspaceId": self.workspaceId, "productType": [], "isp": [], "province": [], "domain": self.get_domain_list, "startTime": self.day_time, "endTime": self.now_time } } self.cp_data_001 = { "data": { "workspaceId": self.workspaceId, "productType": ['001'], "isp": [], "province": [], "domain": self.log.get_bs_cp_domain(self.console_host, self.workspaceId, '001'), "startTime": self.day_time, "endTime": self.now_time } } self.cp_data_003 = { "data": { "workspaceId": self.workspaceId, "productType": ['003'], "isp": [], "province": [], "domain": self.log.get_bs_cp_domain(self.console_host, self.workspaceId, '003'), "startTime": self.day_time, "endTime": self.now_time } } self.cp_data_004 = { "data": { "workspaceId": self.workspaceId, "productType": ['004'], "isp": [], "province": [], "domain": self.log.get_bs_cp_domain(self.console_host, self.workspaceId, '004'), "startTime": self.day_time, "endTime": self.now_time } } self.cp_data_005 = { "data": { "workspaceId": self.workspaceId, "productType": ['005'], "isp": [], "province": [], "domain": self.log.get_bs_cp_domain(self.console_host, self.workspaceId, '005'), "startTime": self.day_time, "endTime": self.now_time } } self.single_domain = { "data": { "workspaceId": self.workspaceId, "productType": [], "isp": [], "province": [], "domain": [random.choice(self.get_domain_list)], "startTime": self.day_time, "endTime": self.now_time } } self.date_data_yesterday = { "data": { "workspaceId": self.workspaceId, "productType": [], "isp": [], "province": [], "domain": self.get_domain_list, "startTime": self.yesterday_time, "endTime": self.now_time } } self.date_data_sevenday = { "data": { "workspaceId": self.workspaceId, "productType": [], "isp": [], "province": [], "domain": self.get_domain_list, "startTime": self.sevenday_time, "endTime": self.now_time } } self.date_data_month = { "data": { "workspaceId": self.workspaceId, "productType": [], "isp": [], "province": [], "domain": self.get_domain_list, "startTime": self.month_time, "endTime": self.now_time } } def teardown_class(self): # 做清数据,退出登录等 self.session.close() print('-------------------test end-------------------') @allure.story(' 单个域名查询用户省份分析数据') def test_CDN_243660(self): url = self.fbrData_url payload = self.single_domain response = self.session.request("GET", url, data=json.dumps(payload), verify=False, timeout=10) print("-------------------查询 dataList 接口-------------------") print('请求url: ' + url) print("请求data: " + str(payload)) print("返回: " + response.text) print("重点验证:" " expect: 返回码与响应时间") assert response.status_code == 200 assert 'core.ok' in response.text assert response.elapsed.total_seconds() < 3 @allure.story(' 单个域名查询用户运营商分析数据') def test_CDN_243661(self): url = self.ispList_url payload = self.single_domain response = self.session.request("GET", url, data=json.dumps(payload), verify=False, timeout=10) print("-------------------查询 dataList 接口-------------------") print('请求url: ' + url) print("请求data: " + str(payload)) print("返回: " + response.text) print("重点验证:" " expect: 返回码与响应时间") assert response.status_code == 200 assert 'core.ok' in response.text assert response.elapsed.total_seconds() < 3 @allure.story(' 视频直播产品查询 用户省份分析数据') def test_CDN_243662(self): url = self.fbrData_url payload = self.cp_data_004 response = self.session.request("GET", url, data=json.dumps(payload), verify=False, timeout=10) print("-------------------查询 dataList 接口-------------------") print('请求url: ' + url) print("请求data: " + str(payload)) print("返回: " + response.text) print("重点验证:" " expect: 返回码与响应时间") assert response.status_code == 200 assert 'core.ok' in response.text assert response.elapsed.total_seconds() < 3 @allure.story(' 视频直播产品查询 用户运营商分析数据') def test_CDN_243663(self): url = self.ispList_url payload = self.cp_data_004 response = self.session.request("GET", url, data=json.dumps(payload), verify=False, timeout=10) print("-------------------查询 dataList 接口-------------------") print('请求url: ' + url) print("请求data: " + str(payload)) print("返回: " + response.text) print("重点验证:" " expect: 返回码与响应时间") assert response.status_code == 200 assert 'core.ok' in response.text assert response.elapsed.total_seconds() < 3 @allure.story(' 视频点播产品查询 用户省份分析数据') def test_CDN_243664(self): url = self.fbrData_url payload = self.cp_data_005 response = self.session.request("GET", url, data=json.dumps(payload), verify=False, timeout=10) print("-------------------查询 dataList 接口-------------------") print('请求url: ' + url) print("请求data: " + str(payload)) print("返回: " + response.text) print("重点验证:" " expect: 返回码与响应时间") assert response.status_code == 200 assert 'core.ok' in response.text assert response.elapsed.total_seconds() < 3 @allure.story(' 视频点播产品查询 用户运营商分析数据') def test_CDN_243665(self): url = self.ispList_url payload = self.cp_data_005 response = self.session.request("GET", url, data=json.dumps(payload), verify=False, timeout=10) print("-------------------查询 dataList 接口-------------------") print('请求url: ' + url) print("请求data: " + str(payload)) print("返回: " + response.text) print("重点验证:" " expect: 返回码与响应时间") assert response.status_code == 200 assert 'core.ok' in response.text assert response.elapsed.total_seconds() < 3 @allure.story(' 下载加速产品查询 用户省份分析数据') def test_CDN_243666(self): url = self.fbrData_url payload = self.cp_data_003 response = self.session.request("GET", url, data=json.dumps(payload), verify=False, timeout=10) print("-------------------查询 dataList 接口-------------------") print('请求url: ' + url) print("请求data: " + str(payload)) print("返回: " + response.text) print("重点验证:" " expect: 返回码与响应时间") assert response.status_code == 200 assert 'core.ok' in response.text assert response.elapsed.total_seconds() < 3 @allure.story(' 下载加速产品查询 用户运营商分析数据') def test_CDN_243667(self): url = self.ispList_url payload = self.cp_data_003 response = self.session.request("GET", url, data=json.dumps(payload), verify=False, timeout=10) print("-------------------查询 dataList 接口-------------------") print('请求url: ' + url) print("请求data: " + str(payload)) print("返回: " + response.text) print("重点验证:" " expect: 返回码与响应时间") assert response.status_code == 200 assert 'core.ok' in response.text assert response.elapsed.total_seconds() < 3 @allure.story(' 静态加速产品查询 用户省份分析数据') def test_CDN_243668(self): url = self.fbrData_url payload = self.cp_data_001 response = self.session.request("GET", url, data=json.dumps(payload), verify=False, timeout=10) print("-------------------查询 dataList 接口-------------------") print('请求url: ' + url) print("请求data: " + str(payload)) print("返回: " + response.text) print("重点验证:" " expect: 返回码与响应时间") assert response.status_code == 200 assert 'core.ok' in response.text assert response.elapsed.total_seconds() < 3 @allure.story(' 静态加速产品查询 用户运营商分析数据') def test_CDN_243669(self): url = self.ispList_url payload = self.cp_data_001 response = self.session.request("GET", url, data=json.dumps(payload), verify=False, timeout=10) print("-------------------查询 dataList 接口-------------------") print('请求url: ' + url) print("请求data: " + str(payload)) print("返回: " + response.text) print("重点验证:" " expect: 返回码与响应时间") assert response.status_code == 200 assert 'core.ok' in response.text assert response.elapsed.total_seconds() < 3 @allure.story(' 默认查询 用户省份分析数据') def test_CDN_243670(self): url = self.fbrData_url payload = self.default_data response = self.session.request("GET", url, data=json.dumps(payload), verify=False, timeout=10) print("-------------------查询 dataList 接口-------------------") print('请求url: ' + url) print("请求data: " + str(payload)) print("返回: " + response.text) print("重点验证:" " expect: 返回码与响应时间") assert response.status_code == 200 assert 'core.ok' in response.text assert response.elapsed.total_seconds() < 3 @allure.story(' 默认查询 用户运营商分析数据') def test_CDN_243671(self): url = self.ispList_url payload = self.default_data response = self.session.request("GET", url, data=json.dumps(payload), verify=False, timeout=10) print("-------------------查询 dataList 接口-------------------") print('请求url: ' + url) print("请求data: " + str(payload)) print("返回: " + response.text) print("重点验证:" " expect: 返回码与响应时间") assert response.status_code == 200 assert 'core.ok' in response.text assert response.elapsed.total_seconds() < 3
class Test_BS_Log_Query(): def setup_class(self): # print('test start') self.session = Init.BS_SESSION self.base_info = Init.BASE_INFO self.log_info = Init.LOG_INFO self.console_host = self.base_info['bsHost'] self.workspaceId = self.base_info['ctyunAcctId'] self.log = CreateLogData() self.get_domain_list = self.log.get_bs_domain_list(self.workspaceId) # 接口 self.flow_url = self.console_host + self.log_info['dataList'] self.miss_dataList_url = self.console_host + self.log_info['missDataList'] self.req_url = self.console_host + self.log_info['requestDataList'] self.hit_url = self.console_host + self.log_info['hit'] self.httpcode_url = self.console_host + self.log_info['httpcode'] self.pvuv_url = self.console_host + self.log_info["pvuv"] # 日期类 self.day_time = self.log.day_time self.yesterday_time = self.log.yesterday_time self.before_yesterday = self.log.before_yesterday self.sevenday_time = self.log.sevenday_time self.month_time = self.log.month_time self.now_time = self.log.now_time # 查询数据 self.default_data = {"data": {"workspaceId": self.workspaceId, "productType": [], "isp": [], "province": [], "domain": self.get_domain_list, "startTime": self.day_time, "endTime": self.now_time}} self.cp_data_001 = {"data": {"workspaceId": self.workspaceId, "productType": ['001'], "isp": [], "province": [], "domain": self.log.get_bs_cp_domain(self.console_host, self.workspaceId,'001'), "startTime": self.day_time,"endTime": self.now_time}} self.cp_data_003 = {"data": {"workspaceId": self.workspaceId, "productType": ['003'], "isp": [], "province": [], "domain": self.log.get_bs_cp_domain(self.console_host, self.workspaceId,'003'), "startTime": self.day_time,"endTime": self.now_time}} self.cp_data_004 = {"data": {"workspaceId": self.workspaceId, "productType": ['004'], "isp": [], "province": [], "domain": self.log.get_bs_cp_domain(self.console_host, self.workspaceId,'004'), "startTime": self.day_time,"endTime": self.now_time}} self.cp_data_005 = {"data": {"workspaceId": self.workspaceId, "productType": ['005'], "isp": [], "province": [], "domain": self.log.get_bs_cp_domain(self.console_host, self.workspaceId,'005'), "startTime": self.day_time,"endTime": self.now_time}} self.isp_data_1 = {"data": {"workspaceId": self.workspaceId, "productType": [], "isp": [1], "province": [], "domain": self.get_domain_list, "startTime": self.day_time, "endTime": self.now_time}} self.isp_data_2 = {"data": {"workspaceId": self.workspaceId, "productType": [], "isp": [2], "province": [], "domain": self.get_domain_list, "startTime": self.day_time, "endTime": self.now_time}} self.isp_data_3 = {"data": {"workspaceId": self.workspaceId, "productType": [], "isp": [3], "province": [], "domain": self.get_domain_list, "startTime": self.day_time, "endTime": self.now_time}} self.isp_data_4 = {"data": {"workspaceId": self.workspaceId, "productType": [], "isp": [4], "province": [], "domain": self.get_domain_list, "startTime": self.day_time, "endTime": self.now_time}} self.isp_data_5 = {"data": {"workspaceId": self.workspaceId, "productType": [], "isp": [5], "province": [], "domain": self.get_domain_list, "startTime": self.day_time, "endTime": self.now_time}} self.isp_data_6 = {"data": {"workspaceId": self.workspaceId, "productType": [], "isp": [6], "province": [], "domain": self.get_domain_list, "startTime": self.day_time, "endTime": self.now_time}} self.isp_data_100 = {"data": {"workspaceId": self.workspaceId, "productType": [], "isp": [100], "province": [], "domain": self.get_domain_list, "startTime": self.day_time, "endTime": self.now_time}} isp_list = [1, 2, 3, 4, 5, 6, 100] self.isp_data_random = { "data": {"workspaceId": self.workspaceId, "productType": [], "isp": [random.choice(isp_list)], "province": [], "domain": self.get_domain_list, "startTime": self.day_time, "endTime": self.now_time}} self.province_data_1 = {"data": {"workspaceId": self.workspaceId, "productType": [], "isp": [], "province": [random.choice(province)], "domain": self.get_domain_list, "startTime": self.day_time, "endTime": self.now_time}} self.province_data_2 = {"data": {"workspaceId": self.workspaceId, "productType": [], "isp": [], "province": [random.choice(province)], "domain": self.get_domain_list, "startTime": self.yesterday_time, "endTime": self.now_time}} self.date_yesterday = { "data": {"workspaceId": self.workspaceId, "productType": [], "isp": [], "province": [], "domain": self.get_domain_list, "startTime": self.yesterday_time, "endTime": self.now_time}} self.date_compare = { "data": {"workspaceId": self.workspaceId, "productType": [], "isp": [], "province": [], "domain": self.get_domain_list, "startTime": self.before_yesterday, "endTime": self.yesterday_time}} self.date_sevenday = { "data": {"workspaceId": self.workspaceId, "productType": [], "isp": [], "province": [], "domain": self.get_domain_list, "startTime": self.sevenday_time, "endTime": self.now_time}} self.date_month = {"data": {"workspaceId": self.workspaceId, "productType": [], "isp": [], "province": [], "domain": self.get_domain_list, "startTime": self.month_time, "endTime": self.now_time}} self.default_pvuv = { "data": {"workspaceId": self.workspaceId, "productType": [], "isp": [], "province": [], "domain": self.get_domain_list, "startTime": self.day_time, "endTime": self.now_time, "ignore": "domain"}} self.random_domain_pvuv = { "data": {"workspaceId": self.workspaceId, "productType": [], "isp": [], "province": [], "domain": [random.choice(self.get_domain_list)], "startTime": self.day_time, "endTime": self.now_time, "ignore": "domain"}} def teardown_class(self): # 做清数据,退出登录等 self.session.close() print('-------------------test end-------------------') @allure.story(' dataList 接口1') def test_CDN_243672(self): url = self.flow_url payload = self.default_data # url = temp + data response = self.session.request("GET", url, data=json.dumps(payload), verify=False, timeout=10) print("-------------------查询 dataList 接口-------------------") print('请求url: ' + url) print("请求data: " + str(payload)) print("返回: " + response.text) print("重点验证:" " expect: 返回码与响应时间") assert response.status_code == 200 assert 'core.ok' in response.text assert response.elapsed.total_seconds() < 3 @allure.story(' missDataList 接口1') def test_CDN_243673(self): url = self.miss_dataList_url payload = self.default_data # url = temp + data response = self.session.request("GET", url, data=json.dumps(payload), verify=False, timeout=10) print("-------------------查询 missDataList 接口-------------------") print('请求url: ' + url) print("请求data: " + str(payload)) print("返回: " + response.text) print("重点验证:" " expect: 返回码与响应时间") assert response.status_code == 200 assert 'core.ok' in response.text assert response.elapsed.total_seconds() < 3 @allure.story(' req_url 接口1') def test_CDN_243674(self): url = self.req_url payload = self.default_data # url = temp + data response = self.session.request("GET", url, data=json.dumps(payload), verify=False, timeout=10) print("-------------------查询 req_url 接口-------------------") print('请求url: ' + url) print("请求data: " + str(payload)) print("返回: " + response.text) print("重点验证:" " expect: 返回码与响应时间") assert response.status_code == 200 assert 'core.ok' in response.text assert response.elapsed.total_seconds() < 3 @allure.story(' hit_url 接口1') def test_CDN_243675(self): url = self.hit_url payload = self.default_data # url = temp + data response = self.session.request("GET", url, data=json.dumps(payload), verify=False, timeout=10) print("-------------------查询 hit_url 接口-------------------") print('请求url: ' + url) print("请求data: " + str(payload)) print("返回: " + response.text) print("重点验证:" " expect: 返回码与响应时间") assert response.status_code == 200 assert 'core.ok' in response.text assert response.elapsed.total_seconds() < 3 @allure.story(' httpcode_url 接口1') def test_CDN_243676(self): url = self.httpcode_url payload = self.default_data # url = temp + data response = self.session.request("GET", url, data=json.dumps(payload), verify=False, timeout=10) print("-------------------查询 httpcode_url 接口-------------------") print('请求url: ' + url) print("请求data: " + str(payload)) print("返回: " + response.text) print("重点验证:" " expect: 返回码与响应时间") assert response.status_code == 200 assert 'core.ok' in response.text assert response.elapsed.total_seconds() < 3 @allure.story(' dataList 接口1') def test_CDN_243677(self): url = self.flow_url payload = self.date_yesterday # url = temp + data response = self.session.request("GET", url, data=json.dumps(payload), verify=False, timeout=10) print("-------------------查询 dataList 接口-------------------") print('请求url: ' + url) print("请求data: " + str(payload)) print("返回: " + response.text) print("重点验证:" " expect: 返回码与响应时间") assert response.status_code == 200 assert 'core.ok' in response.text assert response.elapsed.total_seconds() < 3 @allure.story(' missDataList 接口1') def test_CDN_243678(self): url = self.miss_dataList_url payload = self.date_yesterday # url = temp + data response = self.session.request("GET", url, data=json.dumps(payload), verify=False, timeout=10) print("-------------------查询 missDataList 接口-------------------") print('请求url: ' + url) print("请求data: " + str(payload)) print("返回: " + response.text) print("重点验证:" " expect: 返回码与响应时间") assert response.status_code == 200 assert 'core.ok' in response.text assert response.elapsed.total_seconds() < 3 @allure.story(' req_url 接口1') def test_CDN_243679(self): url = self.req_url payload = self.date_yesterday # url = temp + data response = self.session.request("GET", url, data=json.dumps(payload), verify=False, timeout=10) print("-------------------查询 req_url 接口-------------------") print('请求url: ' + url) print("请求data: " + str(payload)) print("返回: " + response.text) print("重点验证:" " expect: 返回码与响应时间") assert response.status_code == 200 assert 'core.ok' in response.text assert response.elapsed.total_seconds() < 3 @allure.story(' hit_url 接口1') def test_CDN_243680(self): url = self.hit_url payload = self.date_yesterday # url = temp + data response = self.session.request("GET", url, data=json.dumps(payload), verify=False, timeout=10) print("-------------------查询 hit_url 接口-------------------") print('请求url: ' + url) print("请求data: " + str(payload)) print("返回: " + response.text) print("重点验证:" " expect: 返回码与响应时间") assert response.status_code == 200 assert 'core.ok' in response.text assert response.elapsed.total_seconds() < 3 @allure.story(' httpcode_url 接口1') def test_CDN_243681(self): url = self.httpcode_url payload = self.date_yesterday # url = temp + data response = self.session.request("GET", url, data=json.dumps(payload), verify=False, timeout=10) print("-------------------查询 httpcode_url 接口-------------------") print('请求url: ' + url) print("请求data: " + str(payload)) print("返回: " + response.text) print("重点验证:" " expect: 返回码与响应时间") assert response.status_code == 200 assert 'core.ok' in response.text assert response.elapsed.total_seconds() < 3 @allure.story(' dataList 接口1') def test_CDN_243682(self): url = self.flow_url payload = self.date_sevenday # url = temp + data response = self.session.request("GET", url, data=json.dumps(payload), verify=False, timeout=10) print("-------------------查询 dataList 接口-------------------") print('请求url: ' + url) print("请求data: " + str(payload)) print("返回: " + response.text) print("重点验证:" " expect: 返回码与响应时间") assert response.status_code == 200 assert 'core.ok' in response.text assert response.elapsed.total_seconds() < 3 @allure.story(' missDataList 接口1') def test_CDN_243683(self): url = self.miss_dataList_url payload = self.date_sevenday # url = temp + data response = self.session.request("GET", url, data=json.dumps(payload), verify=False, timeout=10) print("-------------------查询 missDataList 接口-------------------") print('请求url: ' + url) print("请求data: " + str(payload)) print("返回: " + response.text) print("重点验证:" " expect: 返回码与响应时间") assert response.status_code == 200 assert 'core.ok' in response.text assert response.elapsed.total_seconds() < 3 @allure.story(' req_url 接口1') def test_CDN_243684(self): url = self.req_url payload = self.date_sevenday # url = temp + data response = self.session.request("GET", url, data=json.dumps(payload), verify=False, timeout=10) print("-------------------查询 req_url 接口-------------------") print('请求url: ' + url) print("请求data: " + str(payload)) print("返回: " + response.text) print("重点验证:" " expect: 返回码与响应时间") assert response.status_code == 200 assert 'core.ok' in response.text assert response.elapsed.total_seconds() < 3 @allure.story(' hit_url 接口1') def test_CDN_243685(self): url = self.hit_url payload = self.date_sevenday # url = temp + data response = self.session.request("GET", url, data=json.dumps(payload), verify=False, timeout=10) print("-------------------查询 hit_url 接口-------------------") print('请求url: ' + url) print("请求data: " + str(payload)) print("返回: " + response.text) print("重点验证:" " expect: 返回码与响应时间") assert response.status_code == 200 assert 'core.ok' in response.text assert response.elapsed.total_seconds() < 3 @allure.story(' httpcode_url 接口1') def test_CDN_243686(self): url = self.httpcode_url payload = self.date_sevenday # url = temp + data response = self.session.request("GET", url, data=json.dumps(payload), verify=False, timeout=10) print("-------------------查询 httpcode_url 接口-------------------") print('请求url: ' + url) print("请求data: " + str(payload)) print("返回: " + response.text) print("重点验证:" " expect: 返回码与响应时间") assert response.status_code == 200 assert 'core.ok' in response.text assert response.elapsed.total_seconds() < 3 @allure.story(' dataList 接口1') def test_CDN_243687(self): url = self.flow_url payload = self.cp_data_001 # url = temp + data response = self.session.request("GET", url, data=json.dumps(payload), verify=False, timeout=10) print("-------------------查询 dataList 接口-------------------") print('请求url: ' + url) print("请求data: " + str(payload)) print("返回: " + response.text) print("重点验证:" " expect: 返回码与响应时间") assert response.status_code == 200 assert 'core.ok' in response.text assert response.elapsed.total_seconds() < 3 @allure.story(' missDataList 接口1') def test_CDN_243688(self): url = self.miss_dataList_url payload = self.cp_data_001 # url = temp + data response = self.session.request("GET", url, data=json.dumps(payload), verify=False, timeout=10) print("-------------------查询 missDataList 接口-------------------") print('请求url: ' + url) print("请求data: " + str(payload)) print("返回: " + response.text) print("重点验证:" " expect: 返回码与响应时间") assert response.status_code == 200 assert 'core.ok' in response.text assert response.elapsed.total_seconds() < 3 @allure.story(' req_url 接口1') def test_CDN_243689(self): url = self.req_url payload = self.cp_data_001 # url = temp + data response = self.session.request("GET", url, data=json.dumps(payload), verify=False, timeout=10) print("-------------------查询 req_url 接口-------------------") print('请求url: ' + url) print("请求data: " + str(payload)) print("返回: " + response.text) print("重点验证:" " expect: 返回码与响应时间") assert response.status_code == 200 assert 'core.ok' in response.text assert response.elapsed.total_seconds() < 3 @allure.story(' hit_url 接口1') def test_CDN_243690(self): url = self.hit_url payload = self.cp_data_001 # url = temp + data response = self.session.request("GET", url, data=json.dumps(payload), verify=False, timeout=10) print("-------------------查询 hit_url 接口-------------------") print('请求url: ' + url) print("请求data: " + str(payload)) print("返回: " + response.text) print("重点验证:" " expect: 返回码与响应时间") assert response.status_code == 200 assert 'core.ok' in response.text assert response.elapsed.total_seconds() < 3 @allure.story(' httpcode_url 接口1') def test_CDN_243691(self): url = self.httpcode_url payload = self.cp_data_001 # url = temp + data response = self.session.request("GET", url, data=json.dumps(payload), verify=False, timeout=10) print("-------------------查询 httpcode_url 接口-------------------") print('请求url: ' + url) print("请求data: " + str(payload)) print("返回: " + response.text) print("重点验证:" " expect: 返回码与响应时间") assert response.status_code == 200 assert 'core.ok' in response.text assert response.elapsed.total_seconds() < 3 @allure.story(' dataList 接口1') def test_CDN_243692(self): url = self.flow_url payload = self.cp_data_003 # url = temp + data response = self.session.request("GET", url, data=json.dumps(payload), verify=False, timeout=10) print("-------------------查询 dataList 接口-------------------") print('请求url: ' + url) print("请求data: " + str(payload)) print("返回: " + response.text) print("重点验证:" " expect: 返回码与响应时间") assert response.status_code == 200 assert 'core.ok' in response.text assert response.elapsed.total_seconds() < 3 @allure.story(' missDataList 接口1') def test_CDN_243693(self): url = self.miss_dataList_url payload = self.cp_data_003 # url = temp + data response = self.session.request("GET", url, data=json.dumps(payload), verify=False, timeout=10) print("-------------------查询 missDataList 接口-------------------") print('请求url: ' + url) print("请求data: " + str(payload)) print("返回: " + response.text) print("重点验证:" " expect: 返回码与响应时间") assert response.status_code == 200 assert 'core.ok' in response.text assert response.elapsed.total_seconds() < 3 @allure.story(' req_url 接口1') def test_CDN_243694(self): url = self.req_url payload = self.cp_data_003 # url = temp + data response = self.session.request("GET", url, data=json.dumps(payload), verify=False, timeout=10) print("-------------------查询 req_url 接口-------------------") print('请求url: ' + url) print("请求data: " + str(payload)) print("返回: " + response.text) print("重点验证:" " expect: 返回码与响应时间") assert response.status_code == 200 assert 'core.ok' in response.text assert response.elapsed.total_seconds() < 3 @allure.story(' hit_url 接口1') def test_CDN_243695(self): url = self.hit_url payload = self.cp_data_003 # url = temp + data response = self.session.request("GET", url, data=json.dumps(payload), verify=False, timeout=10) print("-------------------查询 hit_url 接口-------------------") print('请求url: ' + url) print("请求data: " + str(payload)) print("返回: " + response.text) print("重点验证:" " expect: 返回码与响应时间") assert response.status_code == 200 assert 'core.ok' in response.text assert response.elapsed.total_seconds() < 3 @allure.story(' httpcode_url 接口1') def test_CDN_243696(self): url = self.httpcode_url payload = self.cp_data_003 # url = temp + data response = self.session.request("GET", url, data=json.dumps(payload), verify=False, timeout=10) print("-------------------查询 httpcode_url 接口-------------------") print('请求url: ' + url) print("请求data: " + str(payload)) print("返回: " + response.text) print("重点验证:" " expect: 返回码与响应时间") assert response.status_code == 200 assert 'core.ok' in response.text assert response.elapsed.total_seconds() < 3 @allure.story(' dataList 接口1') def test_CDN_243697(self): url = self.flow_url payload = self.cp_data_004 # url = temp + data response = self.session.request("GET", url, data=json.dumps(payload), verify=False, timeout=10) print("-------------------查询 dataList 接口-------------------") print('请求url: ' + url) print("请求data: " + str(payload)) print("返回: " + response.text) print("重点验证:" " expect: 返回码与响应时间") assert response.status_code == 200 assert 'core.ok' in response.text assert response.elapsed.total_seconds() < 3 @allure.story(' missDataList 接口1') def test_CDN_243698(self): url = self.miss_dataList_url payload = self.cp_data_004 # url = temp + data response = self.session.request("GET", url, data=json.dumps(payload), verify=False, timeout=10) print("-------------------查询 missDataList 接口-------------------") print('请求url: ' + url) print("请求data: " + str(payload)) print("返回: " + response.text) print("重点验证:" " expect: 返回码与响应时间") assert response.status_code == 200 assert 'core.ok' in response.text assert response.elapsed.total_seconds() < 3 @allure.story(' req_url 接口1') def test_CDN_243699(self): url = self.req_url payload = self.cp_data_004 # url = temp + data response = self.session.request("GET", url, data=json.dumps(payload), verify=False, timeout=10) print("-------------------查询 req_url 接口-------------------") print('请求url: ' + url) print("请求data: " + str(payload)) print("返回: " + response.text) print("重点验证:" " expect: 返回码与响应时间") assert response.status_code == 200 assert 'core.ok' in response.text assert response.elapsed.total_seconds() < 3 @allure.story(' hit_url 接口1') def test_CDN_243700(self): url = self.hit_url payload = self.cp_data_004 # url = temp + data response = self.session.request("GET", url, data=json.dumps(payload), verify=False, timeout=10) print("-------------------查询 hit_url 接口-------------------") print('请求url: ' + url) print("请求data: " + str(payload)) print("返回: " + response.text) print("重点验证:" " expect: 返回码与响应时间") assert response.status_code == 200 assert 'core.ok' in response.text assert response.elapsed.total_seconds() < 3 @allure.story(' httpcode_url 接口1') def test_CDN_243701(self): url = self.httpcode_url payload = self.cp_data_004 # url = temp + data response = self.session.request("GET", url, data=json.dumps(payload), verify=False, timeout=10) print("-------------------查询 httpcode_url 接口-------------------") print('请求url: ' + url) print("请求data: " + str(payload)) print("返回: " + response.text) print("重点验证:" " expect: 返回码与响应时间") assert response.status_code == 200 assert 'core.ok' in response.text assert response.elapsed.total_seconds() < 3 @allure.story(' dataList 接口1') def test_CDN_243702(self): url = self.flow_url payload = self.cp_data_005 # url = temp + data response = self.session.request("GET", url, data=json.dumps(payload), verify=False, timeout=10) print("-------------------查询 dataList 接口-------------------") print('请求url: ' + url) print("请求data: " + str(payload)) print("返回: " + response.text) print("重点验证:" " expect: 返回码与响应时间") assert response.status_code == 200 assert 'core.ok' in response.text assert response.elapsed.total_seconds() < 3 @allure.story(' missDataList 接口1') def test_CDN_243703(self): url = self.miss_dataList_url payload = self.cp_data_005 # url = temp + data response = self.session.request("GET", url, data=json.dumps(payload), verify=False, timeout=10) print("-------------------查询 missDataList 接口-------------------") print('请求url: ' + url) print("请求data: " + str(payload)) print("返回: " + response.text) print("重点验证:" " expect: 返回码与响应时间") assert response.status_code == 200 assert 'core.ok' in response.text assert response.elapsed.total_seconds() < 3 @allure.story(' req_url 接口1') def test_CDN_243704(self): url = self.req_url payload = self.cp_data_005 # url = temp + data response = self.session.request("GET", url, data=json.dumps(payload), verify=False, timeout=10) print("-------------------查询 req_url 接口-------------------") print('请求url: ' + url) print("请求data: " + str(payload)) print("返回: " + response.text) print("重点验证:" " expect: 返回码与响应时间") assert response.status_code == 200 assert 'core.ok' in response.text assert response.elapsed.total_seconds() < 3 @allure.story(' hit_url 接口1') def test_CDN_243705(self): url = self.hit_url payload = self.cp_data_005 # url = temp + data response = self.session.request("GET", url, data=json.dumps(payload), verify=False, timeout=10) print("-------------------查询 hit_url 接口-------------------") print('请求url: ' + url) print("请求data: " + str(payload)) print("返回: " + response.text) print("重点验证:" " expect: 返回码与响应时间") assert response.status_code == 200 assert 'core.ok' in response.text assert response.elapsed.total_seconds() < 3 @allure.story(' httpcode_url 接口1') def test_CDN_243706(self): url = self.httpcode_url payload = self.cp_data_005 # url = temp + data response = self.session.request("GET", url, data=json.dumps(payload), verify=False, timeout=10) print("-------------------查询 httpcode_url 接口-------------------") print('请求url: ' + url) print("请求data: " + str(payload)) print("返回: " + response.text) print("重点验证:" " expect: 返回码与响应时间") assert response.status_code == 200 assert 'core.ok' in response.text assert response.elapsed.total_seconds() < 3 @allure.story(' dataList 接口1') def test_CDN_243707(self): url = self.flow_url payload = self.isp_data_random # url = temp + data response = self.session.request("GET", url, data=json.dumps(payload), verify=False, timeout=10) print("-------------------查询 dataList 接口-------------------") print('请求url: ' + url) print("请求data: " + str(payload)) print("返回: " + response.text) print("重点验证:" " expect: 返回码与响应时间") assert response.status_code == 200 assert 'core.ok' in response.text assert response.elapsed.total_seconds() < 3 @allure.story(' missDataList 接口1') def test_CDN_243708(self): url = self.miss_dataList_url payload = self.isp_data_random # url = temp + data response = self.session.request("GET", url, data=json.dumps(payload), verify=False, timeout=10) print("-------------------查询 missDataList 接口-------------------") print('请求url: ' + url) print("请求data: " + str(payload)) print("返回: " + response.text) print("重点验证:" " expect: 返回码与响应时间") assert response.status_code == 200 assert 'core.ok' in response.text assert response.elapsed.total_seconds() < 3 @allure.story(' req_url 接口1') def test_CDN_243709(self): url = self.req_url payload = self.isp_data_random # url = temp + data response = self.session.request("GET", url, data=json.dumps(payload), verify=False, timeout=10) print("-------------------查询 req_url 接口-------------------") print('请求url: ' + url) print("请求data: " + str(payload)) print("返回: " + response.text) print("重点验证:" " expect: 返回码与响应时间") assert response.status_code == 200 assert 'core.ok' in response.text assert response.elapsed.total_seconds() < 3 @allure.story(' hit_url 接口1') def test_CDN_243710(self): url = self.hit_url payload = self.isp_data_random # url = temp + data response = self.session.request("GET", url, data=json.dumps(payload), verify=False, timeout=10) print("-------------------查询 hit_url 接口-------------------") print('请求url: ' + url) print("请求data: " + str(payload)) print("返回: " + response.text) print("重点验证:" " expect: 返回码与响应时间") assert response.status_code == 200 assert 'core.ok' in response.text assert response.elapsed.total_seconds() < 3 @allure.story(' httpcode_url 接口1') def test_CDN_243711(self): url = self.httpcode_url payload = self.isp_data_random # url = temp + data response = self.session.request("GET", url, data=json.dumps(payload), verify=False, timeout=10) print("-------------------查询 httpcode_url 接口-------------------") print('请求url: ' + url) print("请求data: " + str(payload)) print("返回: " + response.text) print("重点验证:" " expect: 返回码与响应时间") assert response.status_code == 200 assert 'core.ok' in response.text assert response.elapsed.total_seconds() < 3 @allure.story(' dataList 接口1') def test_CDN_2437112(self): url = self.flow_url payload = self.province_data_1 # url = temp + data response = self.session.request("GET", url, data=json.dumps(payload), verify=False, timeout=10) print("-------------------查询 dataList 接口-------------------") print('请求url: ' + url) print("请求data: " + str(payload)) print("返回: " + response.text) print("重点验证:" " expect: 返回码与响应时间") assert response.status_code == 200 assert 'core.ok' in response.text assert response.elapsed.total_seconds() < 3 @allure.story(' missDataList 接口1') def test_CDN_243713(self): url = self.miss_dataList_url payload = self.province_data_2 # url = temp + data response = self.session.request("GET", url, data=json.dumps(payload), verify=False, timeout=10) print("-------------------查询 missDataList 接口-------------------") print('请求url: ' + url) print("请求data: " + str(payload)) print("返回: " + response.text) print("重点验证:" " expect: 返回码与响应时间") assert response.status_code == 200 assert 'core.ok' in response.text assert response.elapsed.total_seconds() < 3 @allure.story(' req_url 接口1') def test_CDN_243714(self): url = self.req_url payload = self.province_data_1 # url = temp + data response = self.session.request("GET", url, data=json.dumps(payload), verify=False, timeout=10) print("-------------------查询 req_url 接口-------------------") print('请求url: ' + url) print("请求data: " + str(payload)) print("返回: " + response.text) print("重点验证:" " expect: 返回码与响应时间") assert response.status_code == 200 assert 'core.ok' in response.text assert response.elapsed.total_seconds() < 3 @allure.story(' hit_url 接口1') def test_CDN_243715(self): url = self.hit_url payload = self.province_data_2 # url = temp + data response = self.session.request("GET", url, data=json.dumps(payload), verify=False, timeout=10) print("-------------------查询 hit_url 接口-------------------") print('请求url: ' + url) print("请求data: " + str(payload)) print("返回: " + response.text) print("重点验证:" " expect: 返回码与响应时间") assert response.status_code == 200 assert 'core.ok' in response.text assert response.elapsed.total_seconds() < 3 @allure.story(' httpcode_url 接口1') def test_CDN_243716(self): url = self.httpcode_url payload = self.province_data_1 # url = temp + data response = self.session.request("GET", url, data=json.dumps(payload), verify=False, timeout=10) print("-------------------查询 httpcode_url 接口-------------------") print('请求url: ' + url) print("请求data: " + str(payload)) print("返回: " + response.text) print("重点验证:" " expect: 返回码与响应时间") assert response.status_code == 200 assert 'core.ok' in response.text assert response.elapsed.total_seconds() < 3 @allure.story(' dataList 接口1,默认数据对比') def test_CDN_243717(self): url = self.flow_url payload = self.date_compare # url = temp + data response = self.session.request("GET", url, data=json.dumps(payload), verify=False, timeout=10) print("-------------------查询 dataList 接口-------------------") print('请求url: ' + url) print("请求data: " + str(payload)) print("返回: " + response.text) print("重点验证:" " expect: 返回码与响应时间") assert response.status_code == 200 assert 'core.ok' in response.text assert response.elapsed.total_seconds() < 3 @allure.story(' missDataList 默认数据对比') def test_CDN_243718(self): url = self.miss_dataList_url payload = self.date_compare # url = temp + data response = self.session.request("GET", url, data=json.dumps(payload), verify=False, timeout=10) print("-------------------查询 missDataList 接口-------------------") print('请求url: ' + url) print("请求data: " + str(payload)) print("返回: " + response.text) print("重点验证:" " expect: 返回码与响应时间") assert response.status_code == 200 assert 'core.ok' in response.text assert response.elapsed.total_seconds() < 3 @allure.story(' dataList 接口1') def test_CDN_243719(self): url = self.flow_url payload = self.date_month # url = temp + data response = self.session.request("GET", url, data=json.dumps(payload), verify=False, timeout=10) print("-------------------查询 dataList 接口-------------------") print('请求url: ' + url) print("请求data: " + str(payload)) print("返回: " + response.text) print("重点验证:" " expect: 返回码与响应时间") assert response.status_code == 200 assert 'core.ok' in response.text assert response.elapsed.total_seconds() < 3 @allure.story(' missDataList 接口1') def test_CDN_243720(self): url = self.miss_dataList_url payload = self.date_month # url = temp + data response = self.session.request("GET", url, data=json.dumps(payload), verify=False, timeout=10) print("-------------------查询 missDataList 接口-------------------") print('请求url: ' + url) print("请求data: " + str(payload)) print("返回: " + response.text) print("重点验证:" " expect: 返回码与响应时间") assert response.status_code == 200 assert 'core.ok' in response.text assert response.elapsed.total_seconds() < 3 @allure.story(' req_url 接口1') def test_CDN_243721(self): url = self.req_url payload = self.date_month # url = temp + data response = self.session.request("GET", url, data=json.dumps(payload), verify=False, timeout=10) print("-------------------查询 req_url 接口-------------------") print('请求url: ' + url) print("请求data: " + str(payload)) print("返回: " + response.text) print("重点验证:" " expect: 返回码与响应时间") assert response.status_code == 200 assert 'core.ok' in response.text assert response.elapsed.total_seconds() < 3 @allure.story(' hit_url 接口1') def test_CDN_243722(self): url = self.hit_url payload = self.date_month # url = temp + data response = self.session.request("GET", url, data=json.dumps(payload), verify=False, timeout=10) print("-------------------查询 hit_url 接口-------------------") print('请求url: ' + url) print("请求data: " + str(payload)) print("返回: " + response.text) print("重点验证:" " expect: 返回码与响应时间") assert response.status_code == 200 assert 'core.ok' in response.text assert response.elapsed.total_seconds() < 3 @allure.story(' httpcode_url 接口1') def test_CDN_243723(self): url = self.httpcode_url payload = self.date_month # url = temp + data response = self.session.request("GET", url, data=json.dumps(payload), verify=False, timeout=10) print("-------------------查询 httpcode_url 接口-------------------") print('请求url: ' + url) print("请求data: " + str(payload)) print("返回: " + response.text) print("重点验证:" " expect: 返回码与响应时间") assert response.status_code == 200 assert 'core.ok' in response.text assert response.elapsed.total_seconds() < 3 @allure.story(" GetPvUv 接口1 默认数据查询") def test_CDN_265365(self): url = self.pvuv_url payload = self.default_pvuv response = self.session.post(url, json=payload, verify=False, timeout=10) print("-------------------查询 GetPvUv 接口-------------------") print('请求url: ' + url) print("请求data: " + str(payload)) print("返回: " + response.text) print("重点验证:" " expect: 返回码与响应时间") assert response.status_code == 200 assert 'core.ok' in response.text @allure.story(" GetPvUv 接口1 单域名查询") def test_CDN_265366(self): url = self.pvuv_url payload = self.random_domain_pvuv response = self.session.post(url, json=payload, verify=False, timeout=10) print("-------------------查询 GetPvUv 接口-------------------") print('请求url: ' + url) print("请求data: " + str(payload)) print("返回: " + response.text) print("重点验证:" " expect: 返回码与响应时间") assert response.status_code == 200 assert 'core.ok' in response.text @allure.story(" GetPvUv 接口1 查询昨天的PV/UV") def test_CDN_265367(self): url = self.pvuv_url self.date_yesterday["data"]["ignore"] = "domain" payload = self.date_yesterday response = self.session.post(url, json=payload, verify=False, timeout=10) print("-------------------查询 GetPvUv 接口-------------------") print('请求url: ' + url) print("请求data: " + str(payload)) print("返回: " + response.text) print("重点验证:" " expect: 返回码与响应时间") assert response.status_code == 200 assert 'core.ok' in response.text @allure.story(" GetPvUv 接口1 查询近7天的PV/UV") def test_CDN_265368(self): url = self.pvuv_url self.date_sevenday["data"]["ignore"] = "domain" payload = self.date_sevenday response = self.session.post(url, json=payload, verify=False, timeout=10) print("-------------------查询 GetPvUv 接口-------------------") print('请求url: ' + url) print("请求data: " + str(payload)) print("返回: " + response.text) print("重点验证:" " expect: 返回码与响应时间") assert response.status_code == 200 assert 'core.ok' in response.text @allure.story(" GetPvUv 接口1 查询近30天的PV/UV") def test_CDN_265369(self): url = self.pvuv_url self.date_month["data"]["ignore"] = "domain" payload = self.date_month response = self.session.post(url, json=payload, verify=False, timeout=10) print("-------------------查询 GetPvUv 接口-------------------") print('请求url: ' + url) print("请求data: " + str(payload)) print("返回: " + response.text) print("重点验证:" " expect: 返回码与响应时间") assert response.status_code == 200 assert 'core.ok' in response.text @pytest.mark.skipif(Init.ENV == "ITE", reason="测试环境可能无数据,暂不执行") @allure.story(" 小时粒度,PV峰值/总量正确 ") def test_CDN_270979(self): payload = self.default_pvuv response = self.session.post(self.pvuv_url, json=payload, verify=False, timeout=10) content = json.loads(response.text) hours = content["data"]["hours"] pvCount = [hour["pvCount"] for hour in hours] totalPv = 0 for i in range(0, len(pvCount)): # pv总量 totalPv += pvCount[i] # pv峰值 maxPv = max(pvCount) print("-------------------查询 GetPvUv 接口-------------------") print('请求url: ' + self.pvuv_url) print("请求data: " + str(payload)) print("返回: " + response.text) print("重点验证:" " expect: 返回码与响应时间") assert response.status_code == 200 assert 'core.ok' in response.text assert totalPv == content["data"]["totalPv"] assert maxPv == content["data"]["maxPv"] @pytest.mark.skipif(Init.ENV == "ITE", reason="测试环境可能无数据,暂不执行") @allure.story(" 小时粒度,UV峰值/总量正确 ") def test_CDN_270980(self): payload = self.default_pvuv response = self.session.post(self.pvuv_url, json=payload, verify=False, timeout=10) content = json.loads(response.text) hours = content["data"]["hours"] uvCount = [hour["uvCount"] for hour in hours] totalUv = 0 for i in range(0, len(uvCount)): # pv总量 totalUv += uvCount[i] # pv峰值 maxUv = max(uvCount) print(totalUv, maxUv) print("-------------------查询 GetPvUv 接口-------------------") print('请求url: ' + self.pvuv_url) print("请求data: " + str(payload)) print("返回: " + response.text) print("重点验证:" " expect: 返回码与响应时间") assert response.status_code == 200 assert 'core.ok' in response.text assert totalUv == content["data"]["totalUv"] assert maxUv == content["data"]["maxUv"] @pytest.mark.skipif(Init.ENV == "ITE", reason="测试环境可能无数据,暂不执行") @allure.story(" 天粒度,PV峰值/总量正确 ") def test_CDN_270981(self): self.date_sevenday["data"]["ignore"] = "domain" payload = self.date_sevenday response = self.session.post(self.pvuv_url, json=payload, verify=False, timeout=10) content = json.loads(response.text) hours = content["data"]["daily"] pvCount = [hour["pvCount"] for hour in hours] totalPv = 0 for i in range(0, len(pvCount)): # Pv总量 totalPv += pvCount[i] # Pv峰值 maxPv = max(pvCount) print(totalPv, maxPv) print("-------------------查询 GetPvUv 接口-------------------") print('请求url: ' + self.pvuv_url) print("请求data: " + str(payload)) print("返回: " + response.text) print("重点验证:" " expect: 返回码与响应时间") assert response.status_code == 200 assert 'core.ok' in response.text assert totalPv == content["data"]["totalPv"] assert maxPv == content["data"]["maxPv"] @pytest.mark.skipif(Init.ENV == "ITE", reason="测试环境可能无数据,暂不执行") @allure.story(" 天粒度,UV峰值/总量正确 ") def test_CDN_270982(self): self.date_sevenday["data"]["ignore"] = "domain" payload = self.date_sevenday response = self.session.post(self.pvuv_url, json=payload, verify=False, timeout=10) content = json.loads(response.text) hours = content["data"]["daily"] uvCount = [hour["uvCount"] for hour in hours] totalUv = 0 for i in range(0, len(uvCount)): # Uv总量 totalUv += uvCount[i] # Uv峰值 maxUv = max(uvCount) print(totalUv, maxUv) print("-------------------查询 GetPvUv 接口-------------------") print('请求url: ' + self.pvuv_url) print("请求data: " + str(payload)) print("返回: " + response.text) print("重点验证:" " expect: 返回码与响应时间") assert response.status_code == 200 assert 'core.ok' in response.text assert totalUv == content["data"]["totalUv"] assert maxUv == content["data"]["maxUv"] @pytest.mark.skipif(Init.ENV == "ITE", reason="测试环境可能无数据,暂不执行") @allure.story(" 天粒度,近30天的PV总量大于UV总量 ") def test_CDN_271054(self): # Pv:业务访问量, Uv:独立客户访问量 self.date_month["data"]["ignore"] = "domain" payload = self.date_month response = self.session.post(self.pvuv_url, json=payload, verify=False, timeout=10) content = json.loads(response.text) totalPv = content["data"]["totalPv"] totalUv = content["data"]["totalUv"] print(totalPv, totalUv) print("-------------------查询 GetPvUv 接口-------------------") print('请求url: ' + self.pvuv_url) print("请求data: " + str(payload)) print("返回: " + response.text) print("重点验证:" " expect: Pv总量大于Uv总量") assert response.status_code == 200 assert 'core.ok' in response.text assert totalPv > totalUv