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'
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'
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'
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'
def test_positive(self): Cookie(name='var', value='1', domain_specified=True)
def test_type_check1(self): with pytest.raises(TypeError): Cookie(name='var', value='1', domain_specified=1)
def test_type_check(self): with pytest.raises(TypeError): Cookie(name='var', value='1', path_specified='True')
def test_positive(self): Cookie(name='var', value='1', secure=True)
def test_type_check1(self): with pytest.raises(TypeError): Cookie(name='var', value='1', secure=1)
def test_type_check(self): with pytest.raises(TypeError): Cookie(name='var', value='1', expires='1')
def test_positive(self): Cookie(name='var', value='1', path='1')
def test_positive(self): Cookie(name='var', value='1', domain='1')
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
def test_positive1(self): HTTPCookieManager(cookies=[Cookie(name='var', value='12'),\ Cookie(name='var2', value='22')])
def test_type_check5(self): with pytest.raises(TypeError): HTTPCookieManager( cookies=[Cookie(name='var', value='12'), '23'])
def test_type_check(self): with pytest.raises(TypeError): Cookie(name=123, value='1')
def test_positive(self): Cookie(name='var', value='1', expires=12345678)
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'