def test_cookies_with_domain_and_path(): cookies = Cookies() cookies.set("name", "value", domain="example.com", path="/subpath/1") cookies.set("name", "value", domain="example.com", path="/subpath/2") cookies.clear(domain="example.com", path="/subpath/1") assert len(cookies) == 1 cookies.delete("name", domain="example.com", path="/subpath/2") assert len(cookies) == 0
def test_cookies_with_domain(): cookies = Cookies() cookies.set("name", "value", domain="example.com") cookies.set("name", "value", domain="example.org") with pytest.raises(CookieConflict): cookies["name"] cookies.clear(domain="example.com") assert len(cookies) == 1