mirror of
https://github.com/Hopiu/linkchecker.git
synced 2026-05-09 23:24:44 +00:00
more tests
git-svn-id: https://linkchecker.svn.sourceforge.net/svnroot/linkchecker/trunk/linkchecker@2991 e7d03fd6-7b0d-0410-9947-9c21f3af8025
This commit is contained in:
parent
b1c335e2ae
commit
815fb9da83
1 changed files with 74 additions and 3 deletions
|
|
@ -28,7 +28,7 @@ class TestCookies (tests.StandardTest):
|
|||
Test list dictionary routines.
|
||||
"""
|
||||
|
||||
def test_cookie (self):
|
||||
def test_netscape_cookie1 (self):
|
||||
data = (
|
||||
("Foo", "Bar"),
|
||||
("Comment", "justatest"),
|
||||
|
|
@ -46,7 +46,7 @@ class TestCookies (tests.StandardTest):
|
|||
self.assert_(cookie.is_valid_for("http", host, 80, "/"))
|
||||
self.assert_(cookie.is_valid_for("https", host, 443, "/a"))
|
||||
|
||||
def test_cookie_expired (self):
|
||||
def test_netscape_cookie2 (self):
|
||||
data = (
|
||||
("Foo", "Bar"),
|
||||
("Comment", "justatest"),
|
||||
|
|
@ -62,7 +62,7 @@ class TestCookies (tests.StandardTest):
|
|||
cookie = linkcheck.cookies.NetscapeCookie(value, scheme, host, path)
|
||||
self.assert_(cookie.is_expired())
|
||||
|
||||
def test_cookie_invalid (self):
|
||||
def test_netscape_cookie3 (self):
|
||||
data = (
|
||||
("Foo", "Bar\""),
|
||||
("Port", "hul,la"),
|
||||
|
|
@ -75,6 +75,77 @@ class TestCookies (tests.StandardTest):
|
|||
self.assertRaises(linkcheck.cookies.CookieError,
|
||||
linkcheck.cookies.NetscapeCookie, value, scheme, host, path)
|
||||
|
||||
def test_netscape_cookie4 (self):
|
||||
data = (
|
||||
("Foo", "Bar\""),
|
||||
("Port", "100,555,76"),
|
||||
)
|
||||
parts = ['%s="%s"' % (key, value) for key, value in data]
|
||||
value = "; ".join(parts)
|
||||
scheme = "http"
|
||||
host = "localhost"
|
||||
path = "/"
|
||||
cookie = linkcheck.cookies.NetscapeCookie(value, scheme, host, path)
|
||||
|
||||
def test_rfc_cookie1 (self):
|
||||
data = (
|
||||
("Foo", "Bar"),
|
||||
("Comment", "justatest"),
|
||||
("Max-Age", "1000"),
|
||||
("Path", "/"),
|
||||
("Version", "1"),
|
||||
)
|
||||
parts = ['%s="%s"' % (key, value) for key, value in data]
|
||||
value = "; ".join(parts)
|
||||
scheme = "http"
|
||||
host = "localhost"
|
||||
path = "/"
|
||||
cookie = linkcheck.cookies.Rfc2965Cookie(value, scheme, host, path)
|
||||
self.assert_(cookie.check_expired())
|
||||
self.assert_(cookie.is_valid_for("http", host, 80, "/"))
|
||||
self.assert_(cookie.is_valid_for("https", host, 443, "/a"))
|
||||
|
||||
def test_rfc_cookie2 (self):
|
||||
data = (
|
||||
("Foo", "Bar"),
|
||||
("Comment", "justatest"),
|
||||
("Max-Age", "0"),
|
||||
("Path", "/"),
|
||||
("Version", "1"),
|
||||
)
|
||||
parts = ['%s="%s"' % (key, value) for key, value in data]
|
||||
value = "; ".join(parts)
|
||||
scheme = "http"
|
||||
host = "localhost"
|
||||
path = "/"
|
||||
cookie = linkcheck.cookies.Rfc2965Cookie(value, scheme, host, path)
|
||||
self.assert_(cookie.is_expired())
|
||||
|
||||
def test_rfc_cookie3 (self):
|
||||
data = (
|
||||
("Foo", "Bar\""),
|
||||
("Port", "hul,la"),
|
||||
)
|
||||
parts = ['%s="%s"' % (key, value) for key, value in data]
|
||||
value = "; ".join(parts)
|
||||
scheme = "http"
|
||||
host = "localhost"
|
||||
path = "/"
|
||||
self.assertRaises(linkcheck.cookies.CookieError,
|
||||
linkcheck.cookies.Rfc2965Cookie, value, scheme, host, path)
|
||||
|
||||
def test_rfc_cookie4 (self):
|
||||
data = (
|
||||
("Foo", "Bar\""),
|
||||
("Port", "100,555,76"),
|
||||
)
|
||||
parts = ['%s="%s"' % (key, value) for key, value in data]
|
||||
value = "; ".join(parts)
|
||||
scheme = "http"
|
||||
host = "localhost"
|
||||
path = "/"
|
||||
cookie = linkcheck.cookies.Rfc2965Cookie(value, scheme, host, path)
|
||||
|
||||
|
||||
def test_suite ():
|
||||
"""
|
||||
|
|
|
|||
Loading…
Reference in a new issue