def get_correlation(self, headers, cookies, pre_res):
     headers_para, cookies_para = Base.params_find(headers, cookies)
     if len(headers_para):
         headers_data = pre_res["body"][headers_para[0]]
         headers = Base.res_sub(headers, headers_data)
     if len(cookies_para):
         cookies_data = pre_res["body"][cookies_para[0]]
         cookies = Base.res_sub(cookies, cookies_data)
     return headers, cookies
    def get_correlation(self, headers, cookies, pre_res):
        # 验证是否有关联
        headers_para, cookies_para = Base.params_find(headers, cookies)
        # 有关联,执行前置用例,获取结果
        if len(headers_para):
            headers_data = pre_res["body"][headers_para[0]]
            # 结果替换
            headers = Base.res_sub(headers, headers_data)
        if len(cookies_para):
            cookies_data = pre_res["body"][cookies_para[0]]
            # 结果替换
            cookies = Base.res_sub(headers, cookies_data)

        return headers, cookies
예제 #3
0
 def get_correlation(self, headers, cookies, pre_res):
     """
     关联
     :param headers:
     :param cookies:
     :param pre_res:
     :return:
     """
     # 验证是否有关联
     headers_para, cookies_para = Base.params_find(headers, cookies)
     # 有关联,执行前置用例,获取结果
     if len(headers_para):
         headers_data = pre_res["body"]["data"][headers_para[0]]
         headers = Base.res_sub(headers, headers_data)  # 结果替换
     if len(cookies_para):
         cookies_data = pre_res["body"][cookies_para[0]]
         cookies = Base.res_sub(cookies, cookies_data)  # 结果替换
     return headers, cookies
예제 #4
0
 def get_correlation(self, headers, cookies, pre_res):
     """
     验证是否有关联
     有关联执行前置用例获取结果
     结果的替换
     :return:
     """
     #验证是否关联
     headers_para, cookies_para = Base.params_find(headers, cookies)
     #有关联,执行前置用例,获取结果
     if len(headers_para):
         headers_data = pre_res["body"][headers_para[0]]
         # 替换结果
         headers = Base.res_sub(headers, headers_data)
     if len(cookies_para):
         cookies_para = pre_res["body"][cookies_para[0]]
         #替换结果
         cookies = Base.res_sub(headers, cookies_para)
     return headers, cookies
예제 #5
0
    def get_correlation(self, headers, cookies, pre_res):
        """
        关联
        :param headers:当前用例的请求头
        :param cookies:当前用例的cookies
        :param pre_res:前置用例执行后返回的结果
        :return:
        """
        # 验证是否有关联
        headers_para, cookies_para = Base.params_find(headers, cookies)
        # 有关联,执行前置用例,获取结果
        if len(headers_para):
            headers_data = pre_res['body'][headers_para[0]]
            # 结果替换
            headers = Base.res_sub(headers, headers_data)
        if len(cookies_para):
            cookies_data = pre_res['body'][cookies_para[0]]
            # 结果替换
            cookies = Base.res_sub(cookies, cookies_data)

        return headers, cookies