Пример #1
0
def test_delete_cookie_with_path():
    res = Response()
    res.headers["Set-Cookie"] = "a=2; Path=/"
    res.delete_cookie("a", path="/abc")
    assert res.headerlist[-1][0] == "Set-Cookie"
    val = [x.strip() for x in res.headerlist[-1][1].split(";")]
    assert len(val) == 4
    val.sort()
    assert val[0] == "Max-Age=0"
    assert val[1] == "Path=/abc"
    assert val[2] == "a="
    assert val[3].startswith("expires")
Пример #2
0
def test_delete_cookie_with_path():
    res = Response()
    res.headers['Set-Cookie'] = 'a=2; Path=/'
    res.delete_cookie('a', path='/abc')
    assert res.headerlist[-1][0] == 'Set-Cookie'
    val = [x.strip() for x in res.headerlist[-1][1].split(';')]
    assert len(val) == 4
    val.sort()
    assert val[0] == 'Max-Age=0'
    assert val[1] == 'Path=/abc'
    assert val[2] == 'a='
    assert val[3].startswith('expires')
Пример #3
0
def test_delete_cookie():
    res = Response()
    res.headers['Set-Cookie'] = 'a=2; Path=/'
    res.delete_cookie('a')
    eq_(res.headerlist[-1][0], 'Set-Cookie')
    val = [x.strip() for x in res.headerlist[-1][1].split(';')]
    assert len(val) == 4
    val.sort()
    eq_(val[0], 'Max-Age=0')
    eq_(val[1], 'Path=/')
    eq_(val[2], 'a=')
    assert val[3].startswith('expires')
Пример #4
0
def test_delete_cookie():
    res = Response()
    res.headers['Set-Cookie'] = 'a=2; Path=/'
    res.delete_cookie('a')
    eq_(res.headerlist[-1][0], 'Set-Cookie')
    val = [ x.strip() for x in res.headerlist[-1][1].split(';')]
    assert len(val) == 4
    val.sort()
    eq_(val[0], 'Max-Age=0')
    eq_(val[1], 'Path=/')
    eq_(val[2], 'a=')
    assert val[3].startswith('expires')
Пример #5
0
def test_delete_cookie_with_path():
    res = Response()
    res.headers["Set-Cookie"] = "a=2; Path=/"
    res.delete_cookie("a", path="/abc")
    assert res.headerlist[-1][0] == "Set-Cookie"
    val = [x.strip() for x in res.headerlist[-1][1].split(";")]
    assert len(val) == 4
    val.sort()
    assert val[0] == "Max-Age=0"
    assert val[1] == "Path=/abc"
    assert val[2] == "a="
    assert val[3].startswith("expires")
Пример #6
0
def test_delete_cookie():
    res = Response()
    res.headers["Set-Cookie"] = "a=2; Path=/"
    res.delete_cookie("a")
    eq_(res.headerlist[-1][0], "Set-Cookie")
    val = [x.strip() for x in res.headerlist[-1][1].split(";")]
    assert len(val) == 4
    val.sort()
    eq_(val[0], "Max-Age=0")
    eq_(val[1], "Path=/")
    eq_(val[2], "a=")
    assert val[3].startswith("expires")
Пример #7
0
def test_delete_cookie_with_domain():
    res = Response()
    res.headers['Set-Cookie'] = 'a=2; Path=/'
    res.delete_cookie('a', path='/abc', domain='example.com')
    eq_(res.headerlist[-1][0], 'Set-Cookie')
    val = [x.strip() for x in res.headerlist[-1][1].split(';')]
    assert len(val) == 5
    val.sort()
    eq_(val[0], 'Domain=example.com')
    eq_(val[1], 'Max-Age=0')
    eq_(val[2], 'Path=/abc')
    eq_(val[3], 'a=')
    assert val[4].startswith('expires')
Пример #8
0
def test_delete_cookie_with_domain():
    res = Response()
    res.headers['Set-Cookie'] = 'a=2; Path=/'
    res.delete_cookie('a', path='/abc', domain='example.com')
    eq_(res.headerlist[-1][0], 'Set-Cookie')
    val = [ x.strip() for x in res.headerlist[-1][1].split(';')]
    assert len(val) == 5
    val.sort()
    eq_(val[0], 'Domain=example.com')
    eq_(val[1], 'Max-Age=0')
    eq_(val[2], 'Path=/abc')
    eq_(val[3], 'a=')
    assert val[4].startswith('expires')
Пример #9
0
def test_delete_cookie_with_domain():
    res = Response()
    res.headers["Set-Cookie"] = "a=2; Path=/"
    res.delete_cookie("a", path="/abc", domain="example.com")
    eq_(res.headerlist[-1][0], "Set-Cookie")
    val = [x.strip() for x in res.headerlist[-1][1].split(";")]
    assert len(val) == 5
    val.sort()
    eq_(val[0], "Domain=example.com")
    eq_(val[1], "Max-Age=0")
    eq_(val[2], "Path=/abc")
    eq_(val[3], "a=")
    assert val[4].startswith("expires")