mirror of
https://github.com/Hopiu/linkchecker.git
synced 2026-04-18 05:11:00 +00:00
added robots.txt test
git-svn-id: https://linkchecker.svn.sourceforge.net/svnroot/linkchecker/trunk/linkchecker@1583 e7d03fd6-7b0d-0410-9947-9c21f3af8025
This commit is contained in:
parent
7fb8e33ab3
commit
c266c7e5fd
3 changed files with 47 additions and 0 deletions
2
linkcheck/ftests/data/norobots.html
Normal file
2
linkcheck/ftests/data/norobots.html
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
<meta name="robots" content="nofollow">
|
||||
<a href="do_not_check.html">bla</a>
|
||||
4
linkcheck/ftests/data/norobots.html.result
Normal file
4
linkcheck/ftests/data/norobots.html.result
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
url 'file://%(curdir)s/linkcheck/ftests/data/norobots.html'
|
||||
cache key file://%(curdir)s/linkcheck/ftests/data/norobots.html
|
||||
real url file://%(curdir)s/linkcheck/ftests/data/norobots.html
|
||||
valid
|
||||
41
linkcheck/ftests/test_robotstxt.py
Normal file
41
linkcheck/ftests/test_robotstxt.py
Normal file
|
|
@ -0,0 +1,41 @@
|
|||
# -*- coding: iso-8859-1 -*-
|
||||
"""test HTML robots.txt parsing"""
|
||||
# Copyright (C) 2004 Bastian Kleineidam
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 2 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
|
||||
import unittest
|
||||
import os
|
||||
|
||||
import linkcheck.ftests
|
||||
|
||||
|
||||
class TestRobotsTxt (linkcheck.ftests.StandardTest):
|
||||
"""test robots.txt directive parsing in HTML files"""
|
||||
|
||||
def test_norobot (self):
|
||||
"""test links of norobot.html"""
|
||||
self.file_test("norobots.html")
|
||||
|
||||
|
||||
def test_suite ():
|
||||
"""build and return a TestSuite"""
|
||||
suite = unittest.TestSuite()
|
||||
suite.addTest(unittest.makeSuite(TestRobotsTxt))
|
||||
return suite
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
||||
Loading…
Reference in a new issue