From 29ea22b9bcfcaa61e72bf1b67d4e2c9e18173c72 Mon Sep 17 00:00:00 2001 From: calvin Date: Wed, 25 Aug 2004 18:22:37 +0000 Subject: [PATCH] split directory slash tests git-svn-id: https://linkchecker.svn.sourceforge.net/svnroot/linkchecker/trunk/linkchecker@1486 e7d03fd6-7b0d-0410-9947-9c21f3af8025 --- linkcheck/ftests/test_ftp.py | 42 +++++++++++++++++++++++++----------- 1 file changed, 30 insertions(+), 12 deletions(-) diff --git a/linkcheck/ftests/test_ftp.py b/linkcheck/ftests/test_ftp.py index 65d81517..1312c527 100644 --- a/linkcheck/ftests/test_ftp.py +++ b/linkcheck/ftests/test_ftp.py @@ -27,16 +27,7 @@ class TestFtp (linkcheck.ftests.StandardTest): needed_resources = ['network'] def test_ftp (self): - """test some ftp links""" - # ftp one slash - url = "ftp:/ftp.debian.org/" - resultlines = [ - "url %s" % url, - "cache key %s" % url, - "real url %s" % url, - "error", - ] - self.direct(url, resultlines) + """test ftp link""" # ftp two slashes url = "ftp://ftp.debian.org/" resultlines = [ @@ -46,12 +37,25 @@ class TestFtp (linkcheck.ftests.StandardTest): "valid", ] self.direct(url, resultlines) - # ftp two dir slashes - url = "ftp://ftp.debian.org//debian/" + + def test_ftp_missing_slashes (self): + """test ftp links with missing slashes""" + # ftp one slash + url = "ftp:/ftp.debian.org/" resultlines = [ "url %s" % url, "cache key %s" % url, "real url %s" % url, + "error", + ] + self.direct(url, resultlines) + # missing trailing slash + url = "ftp://ftp.debian.org" + resultlines = [ + "url %s" % url, + "cache key %s" % url, + "real url %s" % url, + "warning Missing trailing directory slash in ftp url", "valid", ] self.direct(url, resultlines) @@ -65,12 +69,26 @@ class TestFtp (linkcheck.ftests.StandardTest): "valid", ] self.direct(url, resultlines) + + def test_ftp_many_slashes (self): + """test ftp links with too many slashes""" + # ftp two dir slashes + url = "ftp://ftp.debian.org//debian/" + resultlines = [ + "url %s" % url, + "cache key %s" % url, + "real url %s" % url, + "warning Too many directory slashes", + "valid", + ] + self.direct(url, resultlines) # ftp many dir slashes url = "ftp://ftp.debian.org////////debian/" resultlines = [ "url %s" % url, "cache key %s" % url, "real url %s" % url, + "warning too many directory slashes", "valid", ] self.direct(url, resultlines)