mirror of
https://github.com/mirror/wget.git
synced 2025-03-10 09:40:17 +08:00
Add new test for recursive spider mode
This commit is contained in:
parent
43bb61b4e3
commit
0758f47954
@ -1,3 +1,8 @@
|
|||||||
|
2013-09-13 Darshit Shah <darnir@gmail.com>
|
||||||
|
|
||||||
|
* Test--spider-r.py: Test retrieval in recursive spider mode.
|
||||||
|
* Makefile.am: add new file
|
||||||
|
|
||||||
2013-09-13 Darshit Shah <darnir@gmail.com>
|
2013-09-13 Darshit Shah <darnir@gmail.com>
|
||||||
|
|
||||||
* HTTPServer.py (_Handler.do_HEAD): If requested path is /, respond
|
* HTTPServer.py (_Handler.do_HEAD): If requested path is /, respond
|
||||||
|
@ -45,7 +45,9 @@ TESTS = Test-auth-basic-fail.py \
|
|||||||
Test-cookie.py \
|
Test-cookie.py \
|
||||||
Test-Head.py \
|
Test-Head.py \
|
||||||
Test-O.py \
|
Test-O.py \
|
||||||
Test-Post.py
|
Test-Post.py \
|
||||||
|
Test--spider-r.py
|
||||||
|
|
||||||
XFAIL_TESTS = Test-auth-both.py
|
XFAIL_TESTS = Test-auth-both.py \
|
||||||
|
Test--spider-r.py
|
||||||
LOG_COMPILER = python3
|
LOG_COMPILER = python3
|
||||||
|
89
testenv/Test--spider-r.py
Executable file
89
testenv/Test--spider-r.py
Executable file
@ -0,0 +1,89 @@
|
|||||||
|
#!/usr/bin/env python3
|
||||||
|
from sys import exit
|
||||||
|
from WgetTest import HTTPTest, WgetFile
|
||||||
|
|
||||||
|
"""
|
||||||
|
This test executed Wget in Spider mode with recursive retrieval.
|
||||||
|
"""
|
||||||
|
TEST_NAME = "Recursive Spider"
|
||||||
|
############# File Definitions ###############################################
|
||||||
|
mainpage = """
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<title>Main Page</title>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<p>
|
||||||
|
Some text and a link to a <a href="http://127.0.0.1:{{port}}/secondpage.html">second page</a>.
|
||||||
|
Also, a <a href="http://127.0.0.1:{{port}}/nonexistent">broken link</a>.
|
||||||
|
</p>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
|
"""
|
||||||
|
|
||||||
|
|
||||||
|
secondpage = """
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<title>Second Page</title>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<p>
|
||||||
|
Some text and a link to a <a href="http://127.0.0.1:{{port}}/thirdpage.html">third page</a>.
|
||||||
|
Also, a <a href="http://127.0.0.1:{{port}}/nonexistent">broken link</a>.
|
||||||
|
</p>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
|
"""
|
||||||
|
|
||||||
|
thirdpage = """
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<title>Third Page</title>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<p>
|
||||||
|
Some text and a link to a <a href="http://127.0.0.1:{{port}}/dummy.txt">text file</a>.
|
||||||
|
Also, another <a href="http://127.0.0.1:{{port}}/againnonexistent">broken link</a>.
|
||||||
|
</p>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
|
"""
|
||||||
|
|
||||||
|
dummyfile = "Don't care."
|
||||||
|
|
||||||
|
|
||||||
|
index_html = WgetFile ("index.html", mainpage)
|
||||||
|
secondpage_html = WgetFile ("secondpage.html", secondpage)
|
||||||
|
thirdpage_html = WgetFile ("thirdpage.html", thirdpage)
|
||||||
|
dummy_txt = WgetFile ("dummy.txt", dummyfile)
|
||||||
|
|
||||||
|
WGET_OPTIONS = "-d --spider -r"
|
||||||
|
WGET_URLS = [[""]]
|
||||||
|
|
||||||
|
Files = [[index_html, secondpage_html, thirdpage_html, dummy_txt]]
|
||||||
|
|
||||||
|
ExpectedReturnCode = 8
|
||||||
|
ExpectedDownloadedFiles = []
|
||||||
|
|
||||||
|
################ Pre and Post Test Hooks #####################################
|
||||||
|
pre_test = {
|
||||||
|
"ServerFiles" : Files
|
||||||
|
}
|
||||||
|
test_options = {
|
||||||
|
"WgetCommands" : WGET_OPTIONS,
|
||||||
|
"Urls" : WGET_URLS
|
||||||
|
}
|
||||||
|
post_test = {
|
||||||
|
"ExpectedFiles" : ExpectedDownloadedFiles,
|
||||||
|
"ExpectedRetcode" : ExpectedReturnCode
|
||||||
|
}
|
||||||
|
|
||||||
|
err = HTTPTest (
|
||||||
|
name=TEST_NAME,
|
||||||
|
pre_hook=pre_test,
|
||||||
|
test_params=test_options,
|
||||||
|
post_hook=post_test
|
||||||
|
).begin ()
|
||||||
|
|
||||||
|
exit (err)
|
Loading…
Reference in New Issue
Block a user