mirror of
https://github.com/mirror/wget.git
synced 2025-01-27 04:40:41 +08:00
From WgetTest.py move WgetFile to misc
create mode 100644 testenv/misc/wget_file.py
This commit is contained in:
parent
422171da81
commit
31e5f33b5e
@ -1,3 +1,9 @@
|
||||
2014-03-13 Zihang Chen <chsc4698@gmail.com>
|
||||
|
||||
* WgetTest.py: Move WgetFile to package misc.
|
||||
* README: Modify documentation respect to WgetFile.
|
||||
* Test-*.py: Optimize imports about WgetFile.
|
||||
|
||||
2014-03-13 Zihang Chen <chsc4698@gmail.com>
|
||||
|
||||
* misc: (new package) package for miscellaneous modules
|
||||
|
@ -31,6 +31,8 @@ Structure:
|
||||
- colour_terminal.py: A custom module for printing coloured output to
|
||||
the terminal. Currently it only supports 4 colours in a *nix
|
||||
environment.
|
||||
- wget_file.py: Module which contains WgetFile, which is a file data
|
||||
container object.
|
||||
|
||||
Working:
|
||||
================================================================================
|
||||
@ -96,7 +98,8 @@ effort to get accustomed to.
|
||||
All Test Files MUST begin with the following Three Lines:
|
||||
#!/usr/bin/python3
|
||||
from sys import exit
|
||||
from WgetTest import {HTTPTest|FTPTest}, WgetFile
|
||||
from WgetTest import {HTTPTest|FTPTest}
|
||||
from misc.wget_file import WgetFile
|
||||
|
||||
It is recommended that a small description of the Test Case is provided next.
|
||||
This would be very helpful to future contributors.
|
||||
@ -104,7 +107,7 @@ Next, is the const variable, TEST_NAME that defines the name of the Test.
|
||||
|
||||
Each File in the Test must be represented as a WgetFile object. The WgetFile
|
||||
Class has the following prototype:
|
||||
WgetFile (String name, String contents, String timestamp, dict rules)
|
||||
WgetFile (str name, str contents, str timestamp, dict rules)
|
||||
None except name is a mandatory paramter, one may pass only those parameters
|
||||
that are required by the File object.
|
||||
|
||||
|
@ -1,6 +1,7 @@
|
||||
#!/usr/bin/env python3
|
||||
from sys import exit
|
||||
from WgetTest import HTTPTest, WgetFile, HTTPS, HTTP
|
||||
from WgetTest import HTTPTest, HTTPS, HTTP
|
||||
from misc.wget_file import WgetFile
|
||||
|
||||
"""
|
||||
This test ensures that Wget can download files from HTTPS Servers
|
||||
|
@ -1,6 +1,7 @@
|
||||
#!/usr/bin/env python3
|
||||
from sys import exit
|
||||
from WgetTest import HTTPTest, WgetFile
|
||||
from WgetTest import HTTPTest
|
||||
from misc.wget_file import WgetFile
|
||||
|
||||
"""
|
||||
This test executed Wget in Spider mode with recursive retrieval.
|
||||
|
@ -1,6 +1,7 @@
|
||||
#!/usr/bin/env python3
|
||||
from sys import exit
|
||||
from WgetTest import HTTPTest, WgetFile
|
||||
from WgetTest import HTTPTest
|
||||
from misc.wget_file import WgetFile
|
||||
|
||||
"""
|
||||
This test ensures that Wget parses the Content-Disposition header
|
||||
|
@ -1,6 +1,7 @@
|
||||
#!/usr/bin/env python3
|
||||
from sys import exit
|
||||
from WgetTest import HTTPTest, WgetFile
|
||||
from WgetTest import HTTPTest
|
||||
from misc.wget_file import WgetFile
|
||||
|
||||
"""
|
||||
This test ensures that Wget parses the Content-Disposition header
|
||||
|
@ -1,6 +1,7 @@
|
||||
#!/usr/bin/env python3
|
||||
from sys import exit
|
||||
from WgetTest import HTTPTest, WgetFile
|
||||
from WgetTest import HTTPTest
|
||||
from misc.wget_file import WgetFile
|
||||
|
||||
"""
|
||||
This test ensures that Wget correctly handles responses to HEAD requests
|
||||
|
@ -1,6 +1,7 @@
|
||||
#!/usr/bin/env python3
|
||||
from sys import exit
|
||||
from WgetTest import HTTPTest, WgetFile
|
||||
from WgetTest import HTTPTest
|
||||
from misc.wget_file import WgetFile
|
||||
|
||||
"""
|
||||
This test ensures that Wget correctly handles the -O command for output
|
||||
|
@ -1,6 +1,7 @@
|
||||
#!/usr/bin/env python3
|
||||
from sys import exit
|
||||
from WgetTest import HTTPTest, WgetFile, HTTP, HTTPS
|
||||
from WgetTest import HTTPTest, HTTP, HTTPS
|
||||
from misc.wget_file import WgetFile
|
||||
|
||||
"""
|
||||
This is a Prototype Test File for multiple servers.
|
||||
|
@ -1,6 +1,7 @@
|
||||
#!/usr/bin/env python3
|
||||
from sys import exit
|
||||
from WgetTest import HTTPTest, WgetFile
|
||||
from WgetTest import HTTPTest
|
||||
from misc.wget_file import WgetFile
|
||||
|
||||
"""
|
||||
Simple test for HTTP POST Requests usiong the --method command
|
||||
|
@ -1,6 +1,7 @@
|
||||
#!/usr/bin/env python3
|
||||
from sys import exit
|
||||
from WgetTest import HTTPTest, WgetFile, HTTP, HTTPS
|
||||
from WgetTest import HTTPTest, HTTP, HTTPS
|
||||
from misc.wget_file import WgetFile
|
||||
|
||||
"""
|
||||
This is a Prototype Test File.
|
||||
|
@ -1,6 +1,7 @@
|
||||
#!/usr/bin/env python3
|
||||
from sys import exit
|
||||
from WgetTest import HTTPTest, WgetFile
|
||||
from WgetTest import HTTPTest
|
||||
from misc.wget_file import WgetFile
|
||||
|
||||
"""
|
||||
This test ensures that Wget returns the correct exit code when Basic
|
||||
|
@ -1,6 +1,7 @@
|
||||
#!/usr/bin/env python3
|
||||
from sys import exit
|
||||
from WgetTest import HTTPTest, WgetFile
|
||||
from WgetTest import HTTPTest
|
||||
from misc.wget_file import WgetFile
|
||||
|
||||
"""
|
||||
This test ensures Wget's Basic Authorization Negotiation.
|
||||
|
@ -1,6 +1,7 @@
|
||||
#!/usr/bin/env python3
|
||||
from sys import exit
|
||||
from WgetTest import HTTPTest, WgetFile
|
||||
from WgetTest import HTTPTest
|
||||
from misc.wget_file import WgetFile
|
||||
|
||||
"""
|
||||
This test ensures Wget's Basic Authorization Negotiation.
|
||||
|
@ -1,6 +1,7 @@
|
||||
#!/usr/bin/env python3
|
||||
from sys import exit
|
||||
from WgetTest import HTTPTest, WgetFile
|
||||
from WgetTest import HTTPTest
|
||||
from misc.wget_file import WgetFile
|
||||
|
||||
"""
|
||||
This test ensures Wget's Digest Authorization Negotiation.
|
||||
|
@ -1,6 +1,7 @@
|
||||
#!/usr/bin/env python3
|
||||
from sys import exit
|
||||
from WgetTest import HTTPTest, WgetFile
|
||||
from WgetTest import HTTPTest
|
||||
from misc.wget_file import WgetFile
|
||||
|
||||
"""
|
||||
This test ensures Wget's Basic Authorization Negotiation, when credentials
|
||||
|
@ -1,6 +1,7 @@
|
||||
#!/usr/bin/env python3
|
||||
from sys import exit
|
||||
from WgetTest import HTTPTest, WgetFile
|
||||
from WgetTest import HTTPTest
|
||||
from misc.wget_file import WgetFile
|
||||
|
||||
"""
|
||||
This test ensures Wget's Basic Authorization Negotiation, when the
|
||||
|
@ -1,6 +1,7 @@
|
||||
#!/usr/bin/env python3
|
||||
from sys import exit
|
||||
from WgetTest import HTTPTest, WgetFile
|
||||
from WgetTest import HTTPTest
|
||||
from misc.wget_file import WgetFile
|
||||
|
||||
"""
|
||||
This test ensures that Wget returns the correct return code when sent
|
||||
|
@ -1,6 +1,7 @@
|
||||
#!/usr/bin/env python3
|
||||
from sys import exit
|
||||
from WgetTest import HTTPTest, WgetFile
|
||||
from WgetTest import HTTPTest
|
||||
from misc.wget_file import WgetFile
|
||||
|
||||
"""
|
||||
This test ensures that Wget handles Content-Disposition correctly when
|
||||
|
@ -1,6 +1,7 @@
|
||||
#!/usr/bin/env python3
|
||||
from sys import exit
|
||||
from WgetTest import HTTPTest, WgetFile
|
||||
from WgetTest import HTTPTest
|
||||
from misc.wget_file import WgetFile
|
||||
|
||||
"""
|
||||
Test Wget's response when the file requested already exists on disk with
|
||||
|
@ -1,6 +1,7 @@
|
||||
#!/usr/bin/env python3
|
||||
from sys import exit
|
||||
from WgetTest import HTTPTest, WgetFile
|
||||
from WgetTest import HTTPTest
|
||||
from misc.wget_file import WgetFile
|
||||
|
||||
"""
|
||||
This test ensures that Wget stores the cookie even in the event of a
|
||||
|
@ -1,6 +1,7 @@
|
||||
#!/usr/bin/env python3
|
||||
from sys import exit
|
||||
from WgetTest import HTTPTest, WgetFile
|
||||
from WgetTest import HTTPTest
|
||||
from misc.wget_file import WgetFile
|
||||
|
||||
"""
|
||||
This test ensures that Wget identifies bad servers trying to set cookies
|
||||
|
@ -1,6 +1,7 @@
|
||||
#!/usr/bin/env python3
|
||||
from sys import exit
|
||||
from WgetTest import HTTPTest, WgetFile
|
||||
from WgetTest import HTTPTest
|
||||
from misc.wget_file import WgetFile
|
||||
|
||||
"""
|
||||
This test ensures that Wget handles Cookie expiry dates correctly.
|
||||
|
@ -1,6 +1,7 @@
|
||||
#!/usr/bin/env python3
|
||||
from sys import exit
|
||||
from WgetTest import HTTPTest, WgetFile
|
||||
from WgetTest import HTTPTest
|
||||
from misc.wget_file import WgetFile
|
||||
|
||||
"""
|
||||
This test ensures that Wget's cookie jar support works correctly.
|
||||
|
@ -318,20 +318,5 @@ class HTTPTest (CommonMethods):
|
||||
self.Request_remaining.append (server_req)
|
||||
server.server_inst.shutdown ()
|
||||
|
||||
""" WgetFile is a File Data Container object """
|
||||
|
||||
class WgetFile:
|
||||
|
||||
def __init__ (
|
||||
self,
|
||||
name,
|
||||
content="Test Contents",
|
||||
timestamp=None,
|
||||
rules=dict()
|
||||
):
|
||||
self.name = name
|
||||
self.content = content
|
||||
self.timestamp = timestamp
|
||||
self.rules = rules
|
||||
|
||||
# vim: set ts=4 sts=4 sw=4 tw=80 et :
|
||||
|
16
testenv/misc/wget_file.py
Normal file
16
testenv/misc/wget_file.py
Normal file
@ -0,0 +1,16 @@
|
||||
|
||||
class WgetFile:
|
||||
|
||||
""" WgetFile is a File Data Container object """
|
||||
|
||||
def __init__ (
|
||||
self,
|
||||
name,
|
||||
content="Test Contents",
|
||||
timestamp=None,
|
||||
rules=None
|
||||
):
|
||||
self.name = name
|
||||
self.content = content
|
||||
self.timestamp = timestamp
|
||||
self.rules = rules or {}
|
Loading…
Reference in New Issue
Block a user