def test_encode(self):
     element = Argument(name='1', value='1', encode=True)
     rendered_doc = tag_wrapper(element.to_xml(), 'result')
     parsed_doc = xmltodict.parse(rendered_doc)
     for tag in parsed_doc['result']['elementProp']['boolProp']:
         if tag['@name'] == 'HTTPArgument.always_encode':
             assert tag['#text'] == 'true'
 def test_value(self):
     element = Argument(name='1', value='2')
     rendered_doc = tag_wrapper(element.to_xml(), 'result')
     parsed_doc = xmltodict.parse(rendered_doc)
     for tag in parsed_doc['result']['elementProp']['stringProp']:
         if tag['@name'] == 'Argument.value':
             assert tag['#text'] == '2'
 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_use_equals(self):
     element = Argument(name='1', value='1')
     rendered_doc = tag_wrapper(element.to_xml(), 'result')
     parsed_doc = xmltodict.parse(rendered_doc)
     for tag in parsed_doc['result']['elementProp']['boolProp']:
         if tag['@name'] == 'HTTPArgument.use_equals':
             assert tag['#text'] == 'true'
     for tag in parsed_doc['result']['elementProp']['stringProp']:
         if tag['@name'] == 'Argument.metadata':
             assert tag['#text'] == '='
 def test_type_check1(self):
     with pytest.raises(TypeError):
         Argument(name='1', value='1', use_equals=1)
 def test_positive(self):
     Argument(name='1', value='1', encode=True)
 def test_type_check1(self):
     with pytest.raises(TypeError):
         Argument(name='1', value='1', encode=1)
 def test_positive(self):
     Argument(value='1', name='1')
 def test_type_check(self):
     with pytest.raises(TypeError):
         Argument(value=1, name='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_positive1(self):
     HTTPRequestDefaults(arguments=[Argument(name='var', value='12'),\
                                 Argument(name='var2', value='22')])
 def test_type_check5(self):
     with pytest.raises(TypeError):
         HTTPRequestDefaults(
             arguments=[Argument(name='var', value='12'), '23'])
 def test_positive(self):
     Argument(name='1', value='1', content_type='text')
 def test_type_check(self):
     with pytest.raises(TypeError):
         Argument(name='1', value='1', content_type=1)
 def test_positive1(self):
     arg = Argument(name='1', value='1', use_equals=True)
     assert arg.metadata == '='