Esempio n. 1
0
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'
Esempio n. 2
0
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'
Esempio n. 3
0
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'