From WgetTest.py move WgetFile to misc

create mode 100644 testenv/misc/wget_file.py
This commit is contained in:
Zihang Chen 2014-03-13 12:17:38 +08:00 committed by Giuseppe Scrivano
parent 422171da81
commit 31e5f33b5e
26 changed files with 71 additions and 39 deletions

View File

@ -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

View File

@ -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.

View File

@ -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

View 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 executed Wget in Spider mode with recursive retrieval.

View 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 parses the Content-Disposition header

View 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 parses the Content-Disposition header

View 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 correctly handles responses to HEAD requests

View 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 correctly handles the -O command for output

View File

@ -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.

View 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
"""
Simple test for HTTP POST Requests usiong the --method command

View File

@ -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.

View 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

View 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 Wget's Basic Authorization Negotiation.

View 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 Wget's Basic Authorization Negotiation.

View 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 Wget's Digest Authorization Negotiation.

View 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 Wget's Basic Authorization Negotiation, when credentials

View 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 Wget's Basic Authorization Negotiation, when the

View 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 return code when sent

View 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 handles Content-Disposition correctly when

View 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
"""
Test Wget's response when the file requested already exists on disk with

View 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 stores the cookie even in the event of a

View 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 identifies bad servers trying to set cookies

View 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 handles Cookie expiry dates correctly.

View 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's cookie jar support works correctly.

View File

@ -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
View 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 {}