def test_set_new_request_cookie_with_cookies_present(): headers = Headers( {'cookie': [{ 'key': 'Cookie', 'value': 'biz=buz; baz=bar', }]}) headers.set_request_cookie(name='foo', value='bar') assert headers.get_request_cookie(name='biz') == 'buz' assert headers.get_request_cookie(name='baz') == 'bar' assert headers.get_request_cookie(name='foo') == 'bar'
def test_set_existing_request_cookie(): headers = Headers({ 'cookie': [{ 'key': 'Cookie', 'value': 'biz=buz; foo=bar; baz=bar', }] }) headers.set_request_cookie(name='foo', value='bub') assert headers.get_request_cookie(name='biz') == 'buz' assert headers.get_request_cookie(name='baz') == 'bar' assert headers.get_request_cookie(name='foo') == 'bub'
def test_set_new_request_cookie_with_no_cookies_present(): headers = Headers() headers.set_request_cookie(name='foo', value='bar') assert headers.get_request_cookie(name='foo') == 'bar'