예제 #1
0
 def test_value(self):
     element = Cookie(name='var', value='1')
     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'] == 'Cookie.value':
             assert tag['#text'] == '1'
예제 #2
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'
예제 #3
0
 def test_bool(self):
     element = Cookie(name='var', 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'] == 'Cookie.secure':
             assert tag['#text'] == 'false'
         elif tag['@name'] == 'Cookie.path_specified':
             assert tag['#text'] == 'true'
         elif tag['@name'] == 'Cookie.domain_specified':
             assert tag['#text'] == 'true'
예제 #4
0
 def test_name(self):
     element = Cookie(name='var', value='1')
     rendered_doc = tag_wrapper(element.to_xml(), 'result')
     parsed_doc = xmltodict.parse(rendered_doc)
     assert parsed_doc['result']['elementProp']['@name'] == 'var'
     assert parsed_doc['result']['elementProp']['@testname'] == 'var'
예제 #5
0
 def test_positive(self):
     Cookie(name='var', value='1', domain_specified=True)
예제 #6
0
 def test_type_check1(self):
     with pytest.raises(TypeError):
         Cookie(name='var', value='1', domain_specified=1)
예제 #7
0
 def test_type_check(self):
     with pytest.raises(TypeError):
         Cookie(name='var', value='1', path_specified='True')
예제 #8
0
 def test_positive(self):
     Cookie(name='var', value='1', secure=True)
예제 #9
0
 def test_type_check1(self):
     with pytest.raises(TypeError):
         Cookie(name='var', value='1', secure=1)
예제 #10
0
 def test_type_check(self):
     with pytest.raises(TypeError):
         Cookie(name='var', value='1', expires='1')
예제 #11
0
 def test_positive(self):
     Cookie(name='var', value='1', path='1')
예제 #12
0
 def test_positive(self):
     Cookie(name='var', value='1', domain='1')
예제 #13
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
예제 #14
0
 def test_positive1(self):
     HTTPCookieManager(cookies=[Cookie(name='var', value='12'),\
                                     Cookie(name='var2', value='22')])
예제 #15
0
 def test_type_check5(self):
     with pytest.raises(TypeError):
         HTTPCookieManager(
             cookies=[Cookie(name='var', value='12'), '23'])
예제 #16
0
 def test_type_check(self):
     with pytest.raises(TypeError):
         Cookie(name=123, value='1')
예제 #17
0
 def test_positive(self):
     Cookie(name='var', value='1', expires=12345678)
예제 #18
0
 def test_expire(self):
     element = Cookie(name='var', value='1', expires=12345678)
     rendered_doc = tag_wrapper(element.to_xml(), 'result')
     parsed_doc = xmltodict.parse(rendered_doc)
     assert parsed_doc['result']['elementProp']['longProp'][
         '#text'] == '12345678'