当前位置: 首页>>代码示例>>Python>>正文


Python JMX._get_http_request方法代码示例

本文整理汇总了Python中bzt.jmx.JMX._get_http_request方法的典型用法代码示例。如果您正苦于以下问题:Python JMX._get_http_request方法的具体用法?Python JMX._get_http_request怎么用?Python JMX._get_http_request使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在bzt.jmx.JMX的用法示例。


在下文中一共展示了JMX._get_http_request方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: compile_http_request

# 需要导入模块: from bzt.jmx import JMX [as 别名]
# 或者: from bzt.jmx.JMX import _get_http_request [as 别名]
    def compile_http_request(self, request):
        """

        :type request: HierarchicHTTPRequest
        :return:
        """
        timeout = request.priority_option('timeout')
        if timeout is not None:
            timeout = self.smart_time(timeout)

        content_type = self._get_merged_ci_headers(request, 'content-type')
        if content_type == 'application/json' and isinstance(request.body, (dict, list)):
            body = json.dumps(request.body)
        else:
            body = request.body

        use_random_host_ip = request.priority_option('random-source-ip', default=False)
        host_ips = get_host_ips(filter_loopbacks=True) if use_random_host_ip else []
        http = JMX._get_http_request(request.url, request.label, request.method, timeout, body,
                                     request.priority_option('keepalive', default=True),
                                     request.upload_files, request.content_encoding,
                                     request.priority_option('follow-redirects', default=True),
                                     use_random_host_ip, host_ips)

        children = etree.Element("hashTree")

        if request.headers:
            children.append(JMX._get_header_mgr(request.headers))
            children.append(etree.Element("hashTree"))

        self.__add_think_time(children, request)

        self.__add_assertions(children, request)

        if timeout is not None:
            children.append(JMX._get_dur_assertion(timeout))
            children.append(etree.Element("hashTree"))

        self.__add_extractors(children, request)

        self.__add_jsr_elements(children, request)

        return [http, children]
开发者ID:keithmork,项目名称:taurus,代码行数:45,代码来源:tools.py

示例2: test_no_port

# 需要导入模块: from bzt.jmx import JMX [as 别名]
# 或者: from bzt.jmx.JMX import _get_http_request [as 别名]
 def test_no_port(self):
     obj = JMX()
     res = obj._get_http_request("http://hostname", "label", "method", 0, {}, True)
     self.assertEqual("", res.find(".//stringProp[@name='HTTPSampler.path']").text)
     self.assertEqual("hostname", res.find(".//stringProp[@name='HTTPSampler.domain']").text)
     self.assertEqual("", res.find(".//stringProp[@name='HTTPSampler.port']").text)
开发者ID:tigerqiu712,项目名称:taurus,代码行数:8,代码来源:test_JMeterExecutor.py

示例3: test_jmx_unicode_checkmark

# 需要导入模块: from bzt.jmx import JMX [as 别名]
# 或者: from bzt.jmx.JMX import _get_http_request [as 别名]
 def test_jmx_unicode_checkmark(self):
     obj = JMX()
     res = obj._get_http_request("url", "label", "method", 0, {"param": u"✓"}, True)
     prop = res.find(".//stringProp[@name='Argument.value']")
     self.assertNotEqual("BINARY", prop.text)
     self.assertEqual(u"✓", prop.text)
开发者ID:tigerqiu712,项目名称:taurus,代码行数:8,代码来源:test_JMeterExecutor.py

示例4: test_variable_hostname

# 需要导入模块: from bzt.jmx import JMX [as 别名]
# 或者: from bzt.jmx.JMX import _get_http_request [as 别名]
 def test_variable_hostname(self):
     obj = JMX()
     res = obj._get_http_request("http://${hostName}:${Port}/${Path}", "label", "method", 0, {}, True)
     self.assertEqual("/${Path}", res.find(".//stringProp[@name='HTTPSampler.path']").text)
     self.assertEqual("${hostName}", res.find(".//stringProp[@name='HTTPSampler.domain']").text)
     self.assertEqual("${Port}", res.find(".//stringProp[@name='HTTPSampler.port']").text)
开发者ID:tigerqiu712,项目名称:taurus,代码行数:8,代码来源:test_JMeterExecutor.py

示例5: test_source_ips_multiple

# 需要导入模块: from bzt.jmx import JMX [as 别名]
# 或者: from bzt.jmx.JMX import _get_http_request [as 别名]
 def test_source_ips_multiple(self):
     obj = JMX()
     res = obj._get_http_request("/", "label", "method", 0, {}, True,
                                 use_random_host_ip=True, host_ips=["192.168.1.1", "192.168.1.2"])
     self.assertEqual("${__chooseRandom(192.168.1.1,192.168.1.2,randomAddr)}",
                      res.find(".//stringProp[@name='HTTPSampler.ipSource']").text)
开发者ID:infomaven,项目名称:taurus,代码行数:8,代码来源:test_JMX.py


注:本文中的bzt.jmx.JMX._get_http_request方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。