adjust test cases for new unquoted base_url and its new warning

git-svn-id: https://linkchecker.svn.sourceforge.net/svnroot/linkchecker/trunk/linkchecker@1531 e7d03fd6-7b0d-0410-9947-9c21f3af8025
This commit is contained in:
calvin 2004-08-27 08:44:36 +00:00
parent 31233bb778
commit 3d678d6d3b
7 changed files with 68 additions and 53 deletions

View file

@ -15,43 +15,46 @@ real url http://localhost:8000/
name ok
error
url http:/localhost:8000/ (cached)
cache key http://localhost:8000/
real url http://localhost:8000/
url http:/localhost:8000/
cache key http:///localhost%%3A8000/
real url http:///localhost%%3A8000/
name one slash
warning Base URL is not properly normed. Normed url is 'http:///localhost%%3A8000/'.
error
url http:localhost:8000/
cache key http:localhost:8000/
real url http:localhost:8000/
url http:localhost:8000/ (cached)
cache key http:///localhost%%3A8000/
real url http:///localhost%%3A8000/
name no slash
warning Base URL is not properly normed. Normed url is 'http:///localhost%%3A8000/'.
error
url http://
cache key http:///
real url http:///
name no url
warning URL path is empty, assuming '/' as path
warning Base URL is not properly normed. Normed url is 'http:///'.
error
url http:/ (cached)
cache key http:///
real url http:///
name no url, one slash
warning URL path is empty, assuming '/' as path
warning Base URL is not properly normed. Normed url is 'http:///'.
error
url http: (cached)
cache key http:///
real url http:///
name no url, no slash
warning URL path is empty, assuming '/' as path
warning Base URL is not properly normed. Normed url is 'http:///'.
error
url http://localhost:8000/stalter&sohn
cache key http://localhost:8000/stalter&sohn
real url http://localhost:8000/stalter&sohn
cache key http://localhost:8000/stalter%%26sohn
real url http://localhost:8000/stalter%%26sohn
name unquoted ampersand
warning Base URL is not properly normed. Normed url is 'http://localhost:8000/stalter%%26sohn'.
error
url http://slashdot.org/
@ -64,19 +67,21 @@ url HtTP://LoCAlHOst:8000/ (cached)
cache key http://localhost:8000/
real url http://localhost:8000/
name should be cached
warning Base URL is not properly normed. Normed url is 'http://localhost:8000/'.
error
url HTTP://LOCALHOST:8000/ (cached)
cache key http://localhost:8000/
real url http://localhost:8000/
name should be cached
warning Base URL is not properly normed. Normed url is 'http://localhost:8000/'.
error
url http://localhost:8000/?quoted=%%FC
url http://localhost:8000/?quoted=ü
cache key http://localhost:8000/?quoted=%%FC
real url http://localhost:8000/?quoted=%%FC
name html entities
warning Base URL is not properly quoted
warning Base URL is not properly normed. Normed url is 'http://localhost:8000/?quoted=%%FC'.
error
url http://localhost:8000/ (cached)

View file

@ -41,7 +41,7 @@ class TestError (linkcheck.ftests.StandardTest):
url = " http://www.heise.de/"
nurl = linkcheck.url.url_norm(url)
resultlines = [
"url %s" % nurl,
"url %s" % url,
"cache key %s" % nurl,
"real url %s" % nurl,
"warning Base URL is not properly quoted",
@ -51,7 +51,7 @@ class TestError (linkcheck.ftests.StandardTest):
url = "http://www.heise.de/ "
nurl = linkcheck.url.url_norm(url)
resultlines = [
"url %s" % nurl,
"url %s" % url,
"cache key %s" % nurl,
"real url %s" % nurl,
"warning Base URL is not properly quoted",
@ -61,7 +61,7 @@ class TestError (linkcheck.ftests.StandardTest):
url = "http://www.heise.de/\n"
nurl = linkcheck.url.url_norm(url)
resultlines = [
"url %s" % nurl,
"url %s" % url,
"cache key %s" % nurl,
"real url %s" % nurl,
"warning Base URL is not properly quoted",
@ -85,7 +85,7 @@ class TestError (linkcheck.ftests.StandardTest):
url = "äöü?:"
nurl = linkcheck.url.url_norm(url)
resultlines = [
"url %s" % nurl,
"url %s" % url,
"cache key %s" % nurl,
"real url %s" % nurl,
"warning Base URL is not properly quoted",
@ -96,7 +96,7 @@ class TestError (linkcheck.ftests.StandardTest):
url = "?äöü?"
nurl = linkcheck.url.url_norm(url)
resultlines = [
"url %s" % nurl,
"url %s" % url,
"cache key %s" % nurl,
"real url %s" % nurl,
"warning Base URL is not properly quoted",
@ -107,7 +107,7 @@ class TestError (linkcheck.ftests.StandardTest):
url = "@³²¼][½ ³@] ¬½"
nurl = linkcheck.url.url_norm(url)
resultlines = [
"url %s" % nurl,
"url %s" % url,
"cache key %s" % nurl,
"real url %s" % nurl,
"warning Base URL is not properly quoted",

View file

@ -66,10 +66,12 @@ class TestFile (linkcheck.ftests.StandardTest):
self.direct(url, resultlines)
# good file (missing double slash)
url = "file:%(curdir)s/%(datadir)s/file.txt" % attrs
nurl = linkcheck.url.url_norm(url)
resultlines = [
"url %s" % url,
"cache key file://%(curdir)s/%(datadir)s/file.txt" % attrs,
"real url file://%(curdir)s/%(datadir)s/file.txt" % attrs,
"warning Base URL is not properly normed. Normed url is %r." % nurl,
"valid",
]
self.direct(url, resultlines)

View file

@ -38,33 +38,37 @@ class TestFtp (linkcheck.ftests.StandardTest):
]
self.direct(url, resultlines)
def test_ftp_missing_slashes (self):
def test_ftp_slashes (self):
"""test ftp links with missing slashes"""
# ftp one slash
url = "ftp:/ftp.debian.org/"
nurl = linkcheck.url.url_norm(url)
resultlines = [
"url %s" % url,
"cache key %s" % url,
"real url %s" % url,
"cache key %s" % nurl,
"real url %s" % nurl,
"warning Base URL is not properly normed. Normed url is %r." % nurl,
"error",
]
self.direct(url, resultlines)
# missing trailing slash
# missing path
url = "ftp://ftp.debian.org"
nurl = linkcheck.url.url_norm(url)
resultlines = [
"url %s" % url,
"cache key %s" % url,
"real url %s" % url,
"warning Missing trailing directory slash in ftp url",
"cache key %s" % nurl,
"real url %s" % nurl,
"warning Base URL is not properly normed. Normed url is %r." % nurl,
"valid",
]
self.direct(url, resultlines)
# missing trailing dir slash
url = "ftp://ftp.debian.org/debian"
nurl = linkcheck.url.url_norm(url)
resultlines = [
"url %s" % url,
"cache key %s" % url,
"real url %s" % url,
"cache key %s" % nurl,
"real url %s" % nurl,
"warning Missing trailing directory slash in ftp url",
"valid",
]
@ -74,21 +78,23 @@ class TestFtp (linkcheck.ftests.StandardTest):
"""test ftp links with too many slashes"""
# ftp two dir slashes
url = "ftp://ftp.debian.org//debian/"
nurl = linkcheck.url.url_norm(url)
resultlines = [
"url %s" % url,
"cache key %s" % url,
"real url %s" % url,
"warning Too many directory slashes",
"cache key %s" % nurl,
"real url %s" % nurl,
"warning Base URL is not properly normed. Normed url is %r." % nurl,
"valid",
]
self.direct(url, resultlines)
# ftp many dir slashes
url = "ftp://ftp.debian.org////////debian/"
nurl = linkcheck.url.url_norm(url)
resultlines = [
"url %s" % url,
"cache key %s" % url,
"real url %s" % url,
"warning too many directory slashes",
"cache key %s" % nurl,
"real url %s" % nurl,
"warning Base URL is not properly normed. Normed url is %r." % nurl,
"valid",
]
self.direct(url, resultlines)

View file

@ -99,28 +99,28 @@ class TestMail (linkcheck.ftests.StandardTest):
def test_warn_mail (self):
"""test some mailto addrs with warnings"""
# contains non-quoted characters
url = "calvin@users.sf.net?subject=äöü"
qurl = self.quote("mailto:"+url)
url = "mailto:calvin@users.sf.net?subject=äöü"
qurl = self.quote(url)
resultlines = [
"url %s" % qurl,
"url %s" % url,
"cache key %s" % qurl,
"real url %s" % qurl,
"info Verified address: <calvin> is deliverable",
"warning Base URL is not properly quoted",
"warning Base URL is not properly normed. Normed url is %r." % qurl,
"valid",
]
self.direct("mailto:"+url, resultlines)
url = "calvin@users.sf.net?subject=Halli hallo"
qurl = self.quote("mailto:"+url)
self.direct(url, resultlines)
url = "mailto:calvin@users.sf.net?subject=Halli hallo"
qurl = self.quote(url)
resultlines = [
"url %s" % qurl,
"url %s" % url,
"cache key %s" % qurl,
"real url %s" % qurl,
"info Verified address: <calvin> is deliverable",
"warning Base URL is not properly quoted",
"warning Base URL is not properly normed. Normed url is %r." % qurl,
"valid",
]
self.direct("mailto:"+url, resultlines)
self.direct(url, resultlines)
url = self.quote("mailto:")
resultlines = [
"url %s" % url,

View file

@ -57,11 +57,12 @@ class TestNews (linkcheck.ftests.StandardTest):
def test_snews (self):
"""test snews: link"""
url = "snews:de.comp.os.unix.linux.misc"
nurl = linkcheck.url.url_norm("snews:de.comp.os.unix.linux.misc")
nurl = linkcheck.url.url_norm(url)
resultlines = [
"url %s" % url,
"cache key %s" % nurl,
"real url %s" % nurl,
"warning Base URL is not properly normed. Normed url is %r." % nurl,
"warning No NNTP server specified, skipping this URL",
"valid",
]
@ -69,17 +70,17 @@ class TestNews (linkcheck.ftests.StandardTest):
def test_illegal (self):
# illegal syntax
url = "§$%&/´`(§%"
qurl = self.quote("news:"+url)
url = "news:§$%&/´`(§%"
qurl = self.quote(url)
resultlines = [
"url %s" % qurl,
"url %s" % url,
"cache key %s" % qurl,
"real url %s" % qurl,
"warning Base URL is not properly quoted",
"warning Base URL is not properly normed. Normed url is %r." % qurl,
"warning No NNTP server specified, skipping this URL",
"valid",
]
self.newstest("news:"+url, resultlines)
self.newstest(url, resultlines)
def test_nntp (self):
"""nttp scheme with host"""

View file

@ -26,11 +26,12 @@ class TestTelnet (linkcheck.ftests.StandardTest):
def test_telnet (self):
url = "telnet:"
rurl = url+"//"
nurl = linkcheck.url.url_norm(url)
resultlines = [
"url %s" % url,
"cache key %s" % rurl,
"real url %s" % rurl,
"cache key %s" % nurl,
"real url %s" % nurl,
"warning Base URL is not properly normed. Normed url is %r." % nurl,
"error",
]
self.direct(url, resultlines)