def test_proxy_pass(self):
     element = HTTPRequestDefaults(proxy_pass='******')
     rendered_doc = tag_wrapper(element.to_xml(), 'result')
     parsed_doc = xmltodict.parse(rendered_doc)
     for tag in parsed_doc['result']['ConfigTestElement']['stringProp']:
         if tag['@name'] == 'HTTPSampler.proxyPass':
             assert tag['#text'] == '123'
 def test_implementation(self):
     element = HTTPRequestDefaults(implementation=Implementation.HTTP)
     rendered_doc = tag_wrapper(element.to_xml(), 'result')
     parsed_doc = xmltodict.parse(rendered_doc)
     for tag in parsed_doc['result']['ConfigTestElement']['stringProp']:
         if tag['@name'] == 'HTTPSampler.implementation':
             assert tag['#text'] == 'HttpClient4'
 def test_ip_source_type(self):
     element = HTTPRequestDefaults(ip_source_type=IpSourceType.IP)
     rendered_doc = tag_wrapper(element.to_xml(), 'result')
     parsed_doc = xmltodict.parse(rendered_doc)
     for tag in parsed_doc['result']['ConfigTestElement']['stringProp']:
         if tag['@name'] == 'HTTPSampler.ipSourceType':
             assert tag['#text'] == '0'
 def test_response_timeout(self):
     element = HTTPRequestDefaults(response_timeout=123)
     rendered_doc = tag_wrapper(element.to_xml(), 'result')
     parsed_doc = xmltodict.parse(rendered_doc)
     for tag in parsed_doc['result']['ConfigTestElement']['stringProp']:
         if tag['@name'] == 'HTTPSampler.response_timeout':
             assert tag['#text'] == '123'
 def test_md5(self):
     element = HTTPRequestDefaults(md5=True)
     rendered_doc = tag_wrapper(element.to_xml(), 'result')
     parsed_doc = xmltodict.parse(rendered_doc)
     for tag in parsed_doc['result']['ConfigTestElement']['stringProp']:
         if tag['@name'] == 'HTTPSampler.md5':
             assert tag['#text'] == 'true'
 def test_encoding(self):
     element = HTTPRequestDefaults(encoding=FileEncoding.UTF8)
     rendered_doc = tag_wrapper(element.to_xml(), 'result')
     parsed_doc = xmltodict.parse(rendered_doc)
     for tag in parsed_doc['result']['ConfigTestElement']['stringProp']:
         if tag['@name'] == 'HTTPSampler.contentEncoding':
             assert tag['#text'] == 'UTF-8'
 def test_empty(self):
     element = HTTPRequestDefaults()
     rendered_doc = tag_wrapper(element.to_xml(), 'result')
     parsed_doc = xmltodict.parse(rendered_doc)
     assert not 'elementProp' in parsed_doc['result']['ConfigTestElement'][
         'elementProp']['collectionProp']
     assert not 'intProp' in parsed_doc['result']['ConfigTestElement']
 def test_concurrent_pool(self):
     element = HTTPRequestDefaults(concurrent_pool=123)
     rendered_doc = tag_wrapper(element.to_xml(), 'result')
     parsed_doc = xmltodict.parse(rendered_doc)
     for tag in parsed_doc['result']['ConfigTestElement']['stringProp']:
         if tag['@name'] == 'HTTPSampler.concurrentPool':
             assert tag['#text'] == '123'
 def test_body(self):
     element = HTTPRequestDefaults(arguments='132456')
     rendered_doc = tag_wrapper(element.to_xml(), 'result')
     parsed_doc = xmltodict.parse(rendered_doc)
     assert parsed_doc['result']['ConfigTestElement']['boolProp'][
         '#text'] == 'true'
     for tag in parsed_doc['result']['ConfigTestElement']['elementProp'][
             'collectionProp']['elementProp']['stringProp']:
         if tag['@name'] == 'Argument.value':
             assert tag['#text'] == '132456'
 def test_args(self):
     element = HTTPRequestDefaults(arguments=[Argument(name='var', value='12'),\
                                         Argument(name='var2', value='22')])
     rendered_doc = tag_wrapper(element.to_xml(), 'result')
     parsed_doc = xmltodict.parse(rendered_doc)
     for tag in parsed_doc['result']['ConfigTestElement']['elementProp'][
             'collectionProp']['elementProp']:
         if tag['@name'] == 'var':
             assert tag['stringProp'][0]['#text'] == '12'
             assert tag['stringProp'][2]['#text'] == 'var'
 def test_positive(self):
     HTTPRequestDefaults(implementation=Implementation.HTTP)
 def test_type_check2(self):
     with pytest.raises(TypeError):
         HTTPRequestDefaults(implementation='HttpClient4')
 def test_positive(self):
     HTTPRequestDefaults(ip_source_type=IpSourceType.IP)
 def test_type_check2(self):
     with pytest.raises(TypeError):
         HTTPRequestDefaults(image_parser=1)
 def test_type_check2(self):
     with pytest.raises(TypeError):
         HTTPRequestDefaults(md5=1)
 def test_positive(self):
     HTTPRequestDefaults(ip_source='123')
 def test_positive(self):
     HTTPRequestDefaults(proxy_scheme='123')
 def test_positive(self):
     HTTPRequestDefaults(embedded_url_re='123')
 def test_type_check(self):
     with pytest.raises(TypeError):
         HTTPRequestDefaults(embedded_url_re=123)
 def test_positive(self):
     HTTPRequestDefaults(proxy_port=123)
 def test_type_check2(self):
     with pytest.raises(TypeError):
         HTTPRequestDefaults(proxy_port=-1)
 def test_positive(self):
     HTTPRequestDefaults(md5=True)
 def test_type_check2(self):
     with pytest.raises(TypeError):
         HTTPRequestDefaults(concurrent_dwn=1)
 def test_positive(self):
     HTTPRequestDefaults(concurrent_dwn=True)
 def test_type_check(self):
     with pytest.raises(TypeError):
         HTTPRequestDefaults(proxy_pass=123)
 def test_positive(self):
     HTTPRequestDefaults(image_parser=True)
 def test_positive(self):
     HTTPRequestDefaults(proxy_pass='******')
 def test_type_check2(self):
     with pytest.raises(TypeError):
         HTTPRequestDefaults(ip_source_type='1')
 def test_hashtree_contain(self):
     element = HTTPRequestDefaults(arguments=[Argument(name='var', value='12'),\
                                         Argument(name='var2', value='22')])
     rendered_doc = tag_wrapper(element.to_xml(), 'result')
     assert '<hashTree />' in rendered_doc
 def test_positive(self):
     HTTPRequestDefaults(response_timeout=12)