Exemplo n.º 1
0
class Test_Vip_Log_dataList():
    def setup_class(self):
        # print('test start')
        self.session = Init.CONSOLE_SESSION
        self.base_info = Init.BASE_INFO
        self.log_info = Init.LOG_INFO
        self.console_host = self.base_info['host']
        self.workspaceId = self.base_info['workspaceid']
        self.log = CreateLogData()
        self.get_domain_list = self.log.get_available_domain_list()

        # 接口
        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 = self.log.common_query_data()
        self.cp_data_001 = {
            "data": {
                "workspaceId": self.workspaceId,
                "productType": ['001'],
                "isp": [],
                "province": [],
                "domain": self.log.get_cp_domain('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_cp_domain('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_cp_domain('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_cp_domain('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_242521(self):
        url = self.fbrData_url
        payload = self.single_domain
        response = self.session.request("GET",
                                        url,
                                        data=json.dumps(payload),
                                        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_242520(self):
        url = self.ispList_url
        payload = self.single_domain
        response = self.session.request("GET",
                                        url,
                                        data=json.dumps(payload),
                                        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_242519(self):
        url = self.fbrData_url
        payload = self.cp_data_004
        response = self.session.request("GET",
                                        url,
                                        data=json.dumps(payload),
                                        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_242518(self):
        url = self.ispList_url
        payload = self.cp_data_004
        response = self.session.request("GET",
                                        url,
                                        data=json.dumps(payload),
                                        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_242517(self):
        url = self.fbrData_url
        payload = self.cp_data_005
        response = self.session.request("GET",
                                        url,
                                        data=json.dumps(payload),
                                        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_242516(self):
        url = self.ispList_url
        payload = self.cp_data_005
        response = self.session.request("GET",
                                        url,
                                        data=json.dumps(payload),
                                        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_242515(self):
        url = self.fbrData_url
        payload = self.cp_data_003
        response = self.session.request("GET",
                                        url,
                                        data=json.dumps(payload),
                                        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_242514(self):
        url = self.ispList_url
        payload = self.cp_data_003
        response = self.session.request("GET",
                                        url,
                                        data=json.dumps(payload),
                                        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_242513(self):
        url = self.fbrData_url
        payload = self.cp_data_001
        response = self.session.request("GET",
                                        url,
                                        data=json.dumps(payload),
                                        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_242512(self):
        url = self.ispList_url
        payload = self.cp_data_001
        response = self.session.request("GET",
                                        url,
                                        data=json.dumps(payload),
                                        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_242511(self):
        url = self.fbrData_url
        payload = self.default_data
        response = self.session.request("GET",
                                        url,
                                        data=json.dumps(payload),
                                        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_242510(self):
        url = self.ispList_url
        payload = self.default_data
        response = self.session.request("GET",
                                        url,
                                        data=json.dumps(payload),
                                        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
Exemplo n.º 2
0
class Test_Vip_Refresh():
    def setup_class(self):
        now = time.strftime("%Y-%m-%d %H:%M:%S", time.localtime())
        day_time = int(time.mktime(datetime.now().date().timetuple()))
        now_time = get_unix_time(now)

        # print('test start')
        self.session = Init.CONSOLE_SESSION
        self.base_info = Init.BASE_INFO
        self.console_host = self.base_info['host']
        self.workspace_id = self.base_info['workspaceid']
        self.head_json = self.base_info['headers_json']
        self.today = day_time
        self.now = now_time
        self.head_form = self.base_info['headers_form']
        # 提取工作区对应的域名列表
        self.log = CreateLogData()
        self.get_domain_list = self.log.get_available_domain_list()

    def teardown_class(self):
        # 做清数据,退出登录等
        self.session.close()
        print('-------------------test end-------------------')

    @allure.story('refresh/ListRefreshTask 接口1')
    def test_CDN_240863(self):
        temp = self.console_host + '/cdn/gw/refresh/ListRefreshTask'
        data = '?workspaceId=' + self.workspace_id + '&page=1&page_size=10&pageSize=10&task_type=1&start_time=' + str(
            self.today) + '&end_time=' + str(self.now) + ''
        payload = {}
        url = temp + data
        response = self.session.request("POST",
                                        url,
                                        data=payload,
                                        verify=False,
                                        timeout=10)
        print("-------------------查询 CreateRefreshTask 接口-------------------")
        print('请求url: ' + url)
        print("请求data: " + str(payload))
        print("返回: " + response.text)
        print("重点验证:" "  expect: 返回码与响应时间")
        assert response.status_code == 200
        assert 'core.ok' in response.text
        assert 'create_time' in response.text
        assert 'total' in response.text
        assert response.elapsed.total_seconds() < 3

    @allure.story('refresh/ListRefreshTask 接口2')
    def test_CDN_240864(self):
        temp = self.console_host + '/cdn/gw/refresh/ListRefreshTask'
        data = '?workspaceId=' + self.workspace_id + '&page=1&page_size=10&pageSize=10&task_type=2&start_time=' + str(
            self.today) + '&end_time=' + str(self.now) + ''
        payload = {}
        url = temp + data
        response = self.session.request("POST",
                                        url,
                                        data=payload,
                                        verify=False,
                                        timeout=10)
        print("-------------------查询 CreateRefreshTask 接口-------------------")
        print('请求url: ' + url)
        print("请求data: " + str(payload))
        print("返回: " + response.text)
        print("重点验证:" "  expect: 返回码与响应时间")
        assert response.status_code == 200
        assert 'core.ok' in response.text
        # assert 'create_time' in response.text
        assert response.elapsed.total_seconds() < 3

    @allure.story('preload/ListPreloadTaskk 接口')
    def test_CDN_240865(self):
        temp = self.console_host + '/cdn/gw/preload/ListPreloadTask'
        data = '?workspaceId=' + self.workspace_id + '&page=1&page_size=10&pageSize=10&start_time=' + str(
            self.today) + '&end_time=' + str(self.now) + ''
        payload = {}
        url = temp + data
        response = self.session.request("POST",
                                        url,
                                        data=payload,
                                        verify=False,
                                        timeout=10)
        print("-------------------查询 CreateRefreshTask 接口-------------------")
        print('请求url: ' + url)
        print("请求data: " + str(payload))
        print("返回: " + response.text)
        print("重点验证:" "  expect: 返回码与响应时间")
        assert response.status_code == 200
        assert 'core.ok' in response.text
        assert 'total' in response.text
        assert response.elapsed.total_seconds() < 3

    # @pytest.mark.skip(reason="调试")  # 跳过该测试
    # @pytest.mark.repeat(50)
    @allure.story('CreateRefreshTask 接口')
    def test_CDN_240866(self):
        url = self.console_host + '/cdn/gw/refresh/CreateRefreshTask'
        domain = "http://" + random.choice(self.get_domain_list)
        # domain='http://zzzzz.baidu.com'
        # 可能随机到泛域名,泛域名是无法刷新的,可以替换成任意字母即可
        if '*' in domain:
            domain = str(domain).replace('*', 'abc')
        payload = {
            "data": {
                "workspaceId": self.workspace_id,
                "values": [domain],
                "domain": "",
                "task_type": "1"
            }
        }
        # url = temp + data
        response = self.session.request("POST",
                                        url,
                                        data=json.dumps(payload),
                                        verify=False,
                                        timeout=10)
        print("-------------------查询 CreateRefreshTask 接口-------------------")
        print('请求url: ' + url)
        print("请求data: " + str(payload))
        print("返回: " + response.text)
        print("重点验证:" "  expect: 返回码与响应时间")
        assert response.status_code == 200
        assert 'core.ok' in response.text
        # assert 'secrets' in response.text
        assert response.elapsed.total_seconds() < 3

    @allure.story('CreateRefreshTask 接口2')
    def test_CDN_240867(self):
        url = self.console_host + '/cdn/gw/refresh/CreateRefreshTask'
        domain = "http://" + random.choice(self.get_domain_list)
        domain_https = "https://" + random.choice(self.get_domain_list)
        value = []
        # 可能随机到泛域名,泛域名是无法刷新的,可以替换成任意字母即可
        if '*' in domain:
            domain = str(domain).replace('*', 'abc')
        if '*' in domain_https:
            domain_https = str(domain_https).replace('*', 'abc')
        value.append(domain_https)
        value.append(domain)
        payload = {
            "data": {
                "workspaceId": self.workspace_id,
                "values": value,
                "domain": "",
                "task_type": "1"
            }
        }
        # url = temp + data
        response = self.session.request("POST",
                                        url,
                                        data=json.dumps(payload),
                                        verify=False,
                                        timeout=10)
        print("-------------------查询 CreateRefreshTask 接口-------------------")
        print('请求url: ' + url)
        print("请求data: " + str(payload))
        print("返回: " + response.text)
        print("重点验证:" "  expect: 返回码与响应时间")
        assert response.status_code == 200
        assert 'core.ok' in response.text
        # assert 'secrets' in response.text
        assert response.elapsed.total_seconds() < 3

    @allure.story('CreateRefreshTask 接口2')
    def test_CDN_240868(self):
        url = self.console_host + '/cdn/gw/refresh/CreateRefreshTask'
        # 只能刷新已启用的域名
        used_domain_list = self.get_domain_list
        value = []
        headers = ["http://", "https://"]
        for item in used_domain_list:
            if '*' not in item:
                value.append(random.choice(headers) + item)
        payload = {
            "data": {
                "workspaceId": self.workspace_id,
                "values": value,
                "domain": "",
                "task_type": "1"
            }
        }
        print(type(payload), payload)
        response = self.session.request("POST",
                                        url,
                                        data=json.dumps(payload),
                                        verify=False,
                                        timeout=10)
        print("-------------------查询 CreateRefreshTask 接口-------------------")
        print('请求url: ' + url)
        print("请求data: " + str(payload))
        print("返回: " + response.text)
        print("重点验证:" "  expect: 返回码与响应时间")
        assert response.status_code == 200
        assert 'core.ok' in response.text
        # assert 'secrets' in response.text
        # assert response.elapsed.total_seconds() < 3

    @allure.story('CreateRefreshTask 刷泛域名')
    def test_CDN_241649(self):
        url = self.console_host + '/cdn/gw/refresh/CreateRefreshTask'
        payload = {
            "data": {
                "workspaceId": self.workspace_id,
                "values": ['http://*.baidu.com'],
                "domain": "",
                "task_type": "1"
            }
        }
        print(type(payload), payload)
        response = self.session.request("POST",
                                        url,
                                        data=json.dumps(payload),
                                        verify=False,
                                        timeout=10)
        print("-------------------查询 CreateRefreshTask 接口-------------------")
        print('请求url: ' + url)
        print("请求data: " + str(payload))
        print("返回: " + response.text)
        print("重点验证:" "  expect: 返回码与响应时间")
        assert response.status_code == 200
        # assert 'core.ok' in response.text
        assert '请求参数错误' in response.text
        # assert 'value_error.url.scheme' in response.text

    @allure.story('CreateRefreshTask 刷泛域名目录')
    def test_CDN_241650(self):
        url = self.console_host + '/cdn/gw/refresh/CreateRefreshTask'
        payload = {
            "data": {
                "workspaceId": self.workspace_id,
                "values": ["http://*.baidu.com/images/"],
                "domain": "",
                "task_type": "2"
            }
        }
        # url = temp + data
        response = self.session.request("POST",
                                        url,
                                        data=json.dumps(payload),
                                        verify=False,
                                        timeout=10)
        print("-------------------查询 CreateRefreshTask 接口-------------------")
        print('请求url: ' + url)
        print("请求data: " + str(payload))
        print("返回: " + response.text)
        print("重点验证:" "  expect: 返回码与响应时间")
        assert response.status_code == 200
        assert '请求参数错误' in response.text
        assert 'value_error' in response.text
        assert response.elapsed.total_seconds() < 3

    @allure.story('CreateRefreshTask 刷没有操作权限的URL')
    def test_CDN_240869(self):
        url = self.console_host + '/cdn/gw/refresh/CreateRefreshTask'
        payload = {
            "data": {
                "workspaceId": self.workspace_id,
                "values": ["http://www.hehehe.com"],
                "domain": "",
                "task_type": "1"
            }
        }
        # url = temp + data
        response = self.session.request("POST",
                                        url,
                                        data=json.dumps(payload),
                                        verify=False,
                                        timeout=10)
        print("-------------------查询 CreateRefreshTask 接口-------------------")
        print('请求url: ' + url)
        print("请求data: " + str(payload))
        print("返回: " + response.text)
        print("重点验证:" "  expect: 返回码与响应时间")
        assert response.status_code == 200
        assert 'core.ok' not in response.text
        assert '填写内容有误,请核对添加的域名' in response.text
        assert response.elapsed.total_seconds() < 3

    @allure.story('CreateRefreshTask 刷目录')
    def test_CDN_240870(self):
        url = self.console_host + '/cdn/gw/refresh/CreateRefreshTask'
        domain = "http://" + random.choice(self.get_domain_list)
        if '*' in domain:
            domain = str(domain).replace('*', 'abc')
        payload = {
            "data": {
                "workspaceId": self.workspace_id,
                "values": [domain + "/images/"],
                "domain": "",
                "task_type": "2"
            }
        }
        # url = temp + data
        response = self.session.request("POST",
                                        url,
                                        data=json.dumps(payload),
                                        verify=False,
                                        timeout=10)
        print("-------------------查询 CreateRefreshTask 接口-------------------")
        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('CreateRefreshTask 刷多个目录')
    def test_CDN_240871(self):
        url = self.console_host + '/cdn/gw/refresh/CreateRefreshTask'
        domain = "http://" + random.choice(self.get_domain_list) + "/images/"
        domain_https = "https://" + random.choice(
            self.get_domain_list) + "/gal.text/"
        value = []
        if '*' in domain:
            domain = str(domain).replace('*', 'abc')
        if '*' in domain_https:
            domain_https = str(domain_https).replace('*', 'abc')
        value.append(domain_https)
        value.append(domain)
        payload = {
            "data": {
                "workspaceId": self.workspace_id,
                "values": value,
                "domain": "",
                "task_type": "2"
            }
        }
        # url = temp + data
        response = self.session.request("POST",
                                        url,
                                        data=json.dumps(payload),
                                        verify=False,
                                        timeout=10)
        print("-------------------查询 CreateRefreshTask 接口-------------------")
        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('CreateRefreshTask,刷新大量目录 ')
    def test_CDN_240872(self):
        url = self.console_host + '/cdn/gw/refresh/CreateRefreshTask'
        # 只能刷新已启用的域名
        used_domain_list = CreateLogData().get_used_domain_list()
        directory_list = ['/images/', '/text/', '/pdf/']
        valuse_list = []
        for temp in used_domain_list:
            valuse_list.append(temp + directory_list[0])
            valuse_list.append(temp + directory_list[1])
            valuse_list.append(temp + directory_list[2])
        payload = {
            "data": {
                "workspaceId": self.workspace_id,
                "values": valuse_list,
                "domain": "",
                "task_type": "2"
            }
        }
        print(type(payload), payload)
        response = self.session.request("POST",
                                        url,
                                        data=json.dumps(payload),
                                        verify=False,
                                        timeout=10)
        print("-------------------查询 CreateRefreshTask 接口-------------------")
        print('请求url: ' + url)
        print("请求data: " + str(payload))
        print("返回: " + response.text)
        print("重点验证:" "  expect: 返回码与响应时间")
        assert response.status_code == 200
        # assert '请求参数错误' in response.text
        # assert '100006' in response.text
        # 由于刷新的目录太多,所有肯定超过3秒,这条不验证
        # assert response.elapsed.total_seconds() < 3

    @allure.story('CreateRefreshTask 刷没有操作权限的目录')
    def test_CDN_240873(self):
        url = self.console_host + '/cdn/gw/refresh/CreateRefreshTask'
        payload = {
            "data": {
                "workspaceId": self.workspace_id,
                "values": ["http://www.hehehe.com/text/"],
                "domain": "",
                "task_type": "2"
            }
        }
        # url = temp + data
        response = self.session.request("POST",
                                        url,
                                        data=json.dumps(payload),
                                        verify=False,
                                        timeout=10)
        print("-------------------查询 CreateRefreshTask 接口-------------------")
        print('请求url: ' + url)
        print("请求data: " + str(payload))
        print("返回: " + response.text)
        print("重点验证:" "  expect: 返回码与响应时间")
        assert response.status_code == 200
        assert 'core.ok' not in response.text
        assert '填写内容有误,请核对添加的域名' in response.text
        assert response.elapsed.total_seconds() < 3

    @allure.story('domain/CheckPrivilege 刷不存在的URL')
    def test_CDN_241653(self):
        url = self.console_host + '/cdn/gw/domain/CheckPrivilege'
        payload = {
            "data": {
                "workspaceId": self.workspace_id,
                "values": ["http://www.baidu55555.com"],
                "do": "c_refresh"
            }
        }
        # url = temp + data
        response = self.session.request("POST",
                                        url,
                                        data=json.dumps(payload),
                                        verify=False,
                                        timeout=10)
        print("-------------------查询 CreateRefreshTask 接口-------------------")
        print('请求url: ' + url)
        print("请求data: " + str(payload))
        print("返回: " + response.text)
        print("重点验证:" "  expect: 返回码与响应时间")
        assert response.status_code == 200
        assert '"list":[{"enable":"false","on":"www.baidu55555.com"}]' in str(
            response.text)
        # assert '填写内容有误,请核对添加的域名' in response.text
        assert response.elapsed.total_seconds() < 3
Exemplo n.º 3
0
class Test_Vip_Top(object):
    def setup_class(self):
        # print('test start')
        self.session = Init.CONSOLE_SESSION
        self.base_info = Init.BASE_INFO
        self.log_info = Init.LOG_INFO
        self.console_host = self.base_info['host']
        self.workspaceId = self.base_info['workspaceid']
        self.log = CreateLogData()
        self.get_domain_list = self.log.get_available_domain_list()

        # 接口
        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_cp_domain('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_cp_domain('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_cp_domain('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_cp_domain('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_cp_domain('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_cp_domain('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_cp_domain('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_cp_domain('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_cp_domain('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_cp_domain('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_cp_domain('004'),
                "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_cp_domain('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_cp_domain('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_cp_domain('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_cp_domain('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_cp_domain('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_cp_domain('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_cp_domain('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_cp_domain('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_cp_domain('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_248713(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_248714(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_248715(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_248716(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_248717(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_248718(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_249250(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_249251(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_249252(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_249253(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_249254(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_249255(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_249256(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_249257(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_249258(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_249259(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_249260(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_249261(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_249262(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_249263(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_249264(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_249264(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_249265(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_249266(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_249267(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_249268(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_249269(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_249270(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_249272(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_249274(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_249276(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_249278(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_249280(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_249281(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_249282(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_249283(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_249284(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_249285(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_249286(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_249287(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_249288(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_249289(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_249290(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