bug-wget
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Bug-wget] [GSoC PATCH 02/11] from WgetTest.py move WgetFile to misc


From: Zihang Chen
Subject: [Bug-wget] [GSoC PATCH 02/11] from WgetTest.py move WgetFile to misc
Date: Fri, 14 Mar 2014 21:18:18 +0800

 create mode 100644 testenv/misc/wget_file.py

diff --git a/testenv/ChangeLog b/testenv/ChangeLog
index dc0878f..9a93f96 100644
--- a/testenv/ChangeLog
+++ b/testenv/ChangeLog
@@ -1,4 +1,8 @@
 2014-03-13  Zihang Chen  <address@hidden>
+       * WgetTest.py: Move WgetFile to package misc.
+       * README: Modify documentation respect to WgetFile.
+       * Test-*.py: Optimize imports about WgetFile.
+2014-03-13  Zihang Chen  <address@hidden>
        * misc: (new package) package for miscellaneous modules
        * ColourTerm.py: Move to package misc and rename to colour_terminal.py,
        add print_color functions to reduce the use of string literals like
diff --git a/testenv/README b/testenv/README
index 09f226a..6b15d70 100644
--- a/testenv/README
+++ b/testenv/README
@@ -93,7 +93,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.
diff --git a/testenv/Test--https.py b/testenv/Test--https.py
index 17252b6..066f2d9 100755
--- a/testenv/Test--https.py
+++ b/testenv/Test--https.py
@@ -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
diff --git a/testenv/Test--spider-r.py b/testenv/Test--spider-r.py
index b770a9f..c099f5a 100755
--- a/testenv/Test--spider-r.py
+++ b/testenv/Test--spider-r.py
@@ -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.
diff --git a/testenv/Test-Content-disposition-2.py 
b/testenv/Test-Content-disposition-2.py
index c2512e1..423ea27 100755
--- a/testenv/Test-Content-disposition-2.py
+++ b/testenv/Test-Content-disposition-2.py
@@ -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
diff --git a/testenv/Test-Content-disposition.py 
b/testenv/Test-Content-disposition.py
index 0a81dea..45914b2 100755
--- a/testenv/Test-Content-disposition.py
+++ b/testenv/Test-Content-disposition.py
@@ -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
diff --git a/testenv/Test-Head.py b/testenv/Test-Head.py
index 49aaa41..d0fad75 100755
--- a/testenv/Test-Head.py
+++ b/testenv/Test-Head.py
@@ -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
diff --git a/testenv/Test-O.py b/testenv/Test-O.py
index 613fbcd..4b3c26a 100755
--- a/testenv/Test-O.py
+++ b/testenv/Test-O.py
@@ -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
diff --git a/testenv/Test-Parallel-Proto.py b/testenv/Test-Parallel-Proto.py
index e7aae2e..6e09bfb 100755
--- a/testenv/Test-Parallel-Proto.py
+++ b/testenv/Test-Parallel-Proto.py
@@ -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.
diff --git a/testenv/Test-Post.py b/testenv/Test-Post.py
index 632326f..d7ad616 100755
--- a/testenv/Test-Post.py
+++ b/testenv/Test-Post.py
@@ -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
diff --git a/testenv/Test-Proto.py b/testenv/Test-Proto.py
index eaafdc1..e6d1aad 100755
--- a/testenv/Test-Proto.py
+++ b/testenv/Test-Proto.py
@@ -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.
diff --git a/testenv/Test-auth-basic-fail.py b/testenv/Test-auth-basic-fail.py
index 894e96d..e2890d5 100755
--- a/testenv/Test-auth-basic-fail.py
+++ b/testenv/Test-auth-basic-fail.py
@@ -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
diff --git a/testenv/Test-auth-basic.py b/testenv/Test-auth-basic.py
index 96141e0..2cafa40 100755
--- a/testenv/Test-auth-basic.py
+++ b/testenv/Test-auth-basic.py
@@ -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.
diff --git a/testenv/Test-auth-both.py b/testenv/Test-auth-both.py
index 9837134..214ef0e 100755
--- a/testenv/Test-auth-both.py
+++ b/testenv/Test-auth-both.py
@@ -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.
diff --git a/testenv/Test-auth-digest.py b/testenv/Test-auth-digest.py
index a66b2c9..44e261f 100755
--- a/testenv/Test-auth-digest.py
+++ b/testenv/Test-auth-digest.py
@@ -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.
diff --git a/testenv/Test-auth-no-challenge-url.py 
b/testenv/Test-auth-no-challenge-url.py
index eb88ac5..e0f851f 100755
--- a/testenv/Test-auth-no-challenge-url.py
+++ b/testenv/Test-auth-no-challenge-url.py
@@ -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
diff --git a/testenv/Test-auth-no-challenge.py 
b/testenv/Test-auth-no-challenge.py
index 774bd59..1d0e355 100755
--- a/testenv/Test-auth-no-challenge.py
+++ b/testenv/Test-auth-no-challenge.py
@@ -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
diff --git a/testenv/Test-auth-retcode.py b/testenv/Test-auth-retcode.py
index adbcbb0..5619f9f 100755
--- a/testenv/Test-auth-retcode.py
+++ b/testenv/Test-auth-retcode.py
@@ -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
diff --git a/testenv/Test-auth-with-content-disposition.py 
b/testenv/Test-auth-with-content-disposition.py
index 50e08ba..a28b088 100755
--- a/testenv/Test-auth-with-content-disposition.py
+++ b/testenv/Test-auth-with-content-disposition.py
@@ -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
diff --git a/testenv/Test-c-full.py b/testenv/Test-c-full.py
index 87ffc52..5b035fd 100755
--- a/testenv/Test-c-full.py
+++ b/testenv/Test-c-full.py
@@ -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
diff --git a/testenv/Test-cookie-401.py b/testenv/Test-cookie-401.py
index 9ca9641..3161d1d 100755
--- a/testenv/Test-cookie-401.py
+++ b/testenv/Test-cookie-401.py
@@ -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
diff --git a/testenv/Test-cookie-domain-mismatch.py 
b/testenv/Test-cookie-domain-mismatch.py
index ae108d9..e6bf7bb 100755
--- a/testenv/Test-cookie-domain-mismatch.py
+++ b/testenv/Test-cookie-domain-mismatch.py
@@ -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
diff --git a/testenv/Test-cookie-expires.py b/testenv/Test-cookie-expires.py
index 2ae3bf9..78bc8b9 100755
--- a/testenv/Test-cookie-expires.py
+++ b/testenv/Test-cookie-expires.py
@@ -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.
diff --git a/testenv/Test-cookie.py b/testenv/Test-cookie.py
index 7f5b093..df62d14 100755
--- a/testenv/Test-cookie.py
+++ b/testenv/Test-cookie.py
@@ -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.
diff --git a/testenv/WgetTest.py b/testenv/WgetTest.py
index ba34d8d..b07faa0 100644
--- a/testenv/WgetTest.py
+++ b/testenv/WgetTest.py
@@ -320,20 +320,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 :
diff --git a/testenv/misc/wget_file.py b/testenv/misc/wget_file.py
new file mode 100644
index 0000000..63fc04d
--- /dev/null
+++ b/testenv/misc/wget_file.py
@@ -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 {}
\ No newline at end of file
-- 
1.8.3.2




reply via email to

[Prev in Thread] Current Thread [Next in Thread]