Fix assertion checking external links; fix tests

This commit is contained in:
Bastian Kleineidam 2014-03-10 18:23:44 +01:00
parent 40b663cf9e
commit bca226c293
8 changed files with 40 additions and 33 deletions

View file

@ -2,13 +2,17 @@
Features:
- checking: Support parsing of sitemap and sitemap index XML files.
- checking: Fix URL result caching.
- logging: Support arbitrary encodings in CSV output.
Closes: GH bug #467
Changes:
- checking: Ignored URLs are reported earlier now.
Fixes:
- checking: Fix internal errors in debug output.
Closes: GH bug #472
- checking: Fix URL result caching.
- checking: Fix assertion in external link checking.
9.0 "The Wolf of Wall Street" (released 3.3.2014)

View file

@ -118,6 +118,11 @@ class UrlBase (object):
if recursion_level == 0:
self.add_intern_pattern()
self.set_extern(self.url)
if self.extern[0] and self.extern[1]:
self.add_info(_("The URL is outside of the domain "
"filter, checked only syntax."))
if not self.has_result:
self.set_result(_("filtered"))
def init (self, base_ref, base_url, parent_url, recursion_level,
aggregate, line, column, name, url_encoding, extern):
@ -594,11 +599,6 @@ class UrlBase (object):
self.extern = (1, 0)
else:
self.extern = (1, 1)
if self.extern[0] and self.extern[1]:
self.add_info(_("The URL is outside of the domain "
"filter, checked only syntax."))
if not self.has_result:
self.set_result(_("filtered"))
def set_content_type (self):
"""Set content MIME type.

View file

@ -4,15 +4,15 @@ real url file://%(curdir)s/%(datadir)s/file.html
name %(datadir)s/file.html
valid
url file.html
cache key file://%(curdir)s/%(datadir)s/file.html
real url file://%(curdir)s/%(datadir)s/file.html
name relative url
valid
url javascript:loadthis()
cache key javascript:loadthis()
real url javascript:loadthis()
name javascript url
info Javascript URL ignored.
valid
url file.html
cache key file://%(curdir)s/%(datadir)s/file.html
real url file://%(curdir)s/%(datadir)s/file.html
name relative url
valid

View file

@ -4,10 +4,11 @@ real url file://%(curdir)s/%(datadir)s/file.php
name %(datadir)s/file.php
valid
url anchor.html
cache key file://%(curdir)s/%(datadir)s/anchor.html
real url file://%(curdir)s/%(datadir)s/anchor.html
name Bla
url test_<?php echo $module ?>
cache key file://%(curdir)s/%(datadir)s/test_%%3C?php%%20echo%%20%%24module%%20?%%3E
real url file://%(curdir)s/%(datadir)s/test_%%3C?php%%20echo%%20%%24module%%20?%%3E
name PHP 2
info File URL ignored.
valid
url test_<? echo $module ?>
@ -17,9 +18,8 @@ name PHP 1
info File URL ignored.
valid
url test_<?php echo $module ?>
cache key file://%(curdir)s/%(datadir)s/test_%%3C?php%%20echo%%20%%24module%%20?%%3E
real url file://%(curdir)s/%(datadir)s/test_%%3C?php%%20echo%%20%%24module%%20?%%3E
name PHP 2
info File URL ignored.
url anchor.html
cache key file://%(curdir)s/%(datadir)s/anchor.html
real url file://%(curdir)s/%(datadir)s/anchor.html
name Bla
valid

View file

@ -3,6 +3,12 @@ cache key http://localhost:%(port)d/%(datadir)s/http.html
real url http://localhost:%(port)d/%(datadir)s/http.html
valid
url clsid:12345-67890
cache key clsid:12345-67890
real url clsid:12345-67890
info Clsid URL ignored.
valid
url
cache key http://localhost:%(port)d/%(datadir)s/http.html
real url http://localhost:%(port)d/%(datadir)s/http.html
@ -64,12 +70,6 @@ real url http://localhost:%(port)d/tests/checker/data/file.txt
name CSS urls
valid
url clsid:12345-67890
cache key clsid:12345-67890
real url clsid:12345-67890
info Clsid URL ignored.
valid
url http://example.org/foo/ #a=1,2,3
cache key http://example.org/foo/%%20
real url http://example.org/foo/%%20#a%%3D1%%2C2%%2C3

View file

@ -7,6 +7,7 @@ valid
url
cache key None
real url
info The URL is outside of the domain filter, checked only syntax.
error
url http://www.example.com/

View file

@ -4,13 +4,13 @@ real url file://%(curdir)s/%(datadir)s/urllist.txt
name %(datadir)s/urllist.txt
valid
url file.html
cache key file://%(curdir)s/%(datadir)s/file.html
real url file://%(curdir)s/%(datadir)s/file.html
valid
url javascript:loadthis()
cache key javascript:loadthis()
real url javascript:loadthis()
info Javascript URL ignored.
valid
url file.html
cache key file://%(curdir)s/%(datadir)s/file.html
real url file://%(curdir)s/%(datadir)s/file.html
valid

View file

@ -17,6 +17,7 @@
"""
Test news checking.
"""
import pytest
from tests import need_newsserver, limit_time
from . import LinkCheckTest
@ -30,7 +31,8 @@ NNTP_INFO = u"200 news.uni-stuttgart.de InterNetNews NNRP server " \
NNTP_TIMEOUT_SECS = 30
# disabled for now until some stable news server comes up
class _TestNews (LinkCheckTest):
@pytest.mark.skipif("True")
class TestNews (LinkCheckTest):
"""Test nntp: and news: link checking."""
def newstest (self, url, resultlines):