Exemplo n.º 1
0
 def test_cookie(self):
     element = HTTPCookieManager(cookies=[Cookie(name='var', value='12'),\
                                         Cookie(name='var2', value='22')])
     rendered_doc = tag_wrapper(element.to_xml(), 'result')
     parsed_doc = xmltodict.parse(rendered_doc)
     for tag in parsed_doc['result']['CookieManager']['collectionProp'][
             'elementProp']:
         if tag['@name'] == 'var':
             assert tag['@testname'] == 'var'
             assert tag['stringProp'][0]['#text'] == '12'
Exemplo n.º 2
0
 def test_hashtree_contain(self):
     element = HTTPCookieManager(cookies=[Cookie(name='var', value='12'),\
                                         Cookie(name='var2', value='22')])
     rendered_doc = tag_wrapper(element.to_xml(), 'result')
     assert '<hashTree />' in rendered_doc
Exemplo n.º 3
0
 def test_empty(self):
     element = HTTPCookieManager()
     rendered_doc = tag_wrapper(element.to_xml(), 'result')
     parsed_doc = xmltodict.parse(rendered_doc)
     assert not 'elementProp' in parsed_doc['result']['CookieManager'][
         'collectionProp']
Exemplo n.º 4
0
 def test_policy(self):
     element = HTTPCookieManager(policy=CookiePolicy.DEFAULT)
     rendered_doc = tag_wrapper(element.to_xml(), 'result')
     parsed_doc = xmltodict.parse(rendered_doc)
     assert parsed_doc['result']['CookieManager']['stringProp'][
         '#text'] == 'default'
Exemplo n.º 5
0
 def test_clear_each_iter(self):
     element = HTTPCookieManager(clear_each_iter=True)
     rendered_doc = tag_wrapper(element.to_xml(), 'result')
     parsed_doc = xmltodict.parse(rendered_doc)
     assert parsed_doc['result']['CookieManager']['boolProp'][
         '#text'] == 'true'