summaryrefslogtreecommitdiff
path: root/testenv/Test-416.py
diff options
context:
space:
mode:
authorDongHun Kwak <dh0128.kwak@samsung.com>2021-03-05 10:08:21 +0900
committerDongHun Kwak <dh0128.kwak@samsung.com>2021-03-05 10:08:21 +0900
commit8abe09f3b00fd31d1af24d3038f881034506d651 (patch)
tree057549dc80e468dce35223ddb305aa362968ed53 /testenv/Test-416.py
parentafd456999b076e5e6505dd5ca6942a5e7471c70c (diff)
downloadwget-8abe09f3b00fd31d1af24d3038f881034506d651.tar.gz
wget-8abe09f3b00fd31d1af24d3038f881034506d651.tar.bz2
wget-8abe09f3b00fd31d1af24d3038f881034506d651.zip
Imported Upstream version 1.19.3upstream/1.19.3
Diffstat (limited to 'testenv/Test-416.py')
-rwxr-xr-xtestenv/Test-416.py53
1 files changed, 53 insertions, 0 deletions
diff --git a/testenv/Test-416.py b/testenv/Test-416.py
new file mode 100755
index 0000000..76b9421
--- /dev/null
+++ b/testenv/Test-416.py
@@ -0,0 +1,53 @@
+#!/usr/bin/env python3
+from sys import exit
+from test.http_test import HTTPTest
+from misc.wget_file import WgetFile
+
+"""
+ Ensure that Wget behaves well when the server responds with a HTTP 416
+ status code. This test checks both cases:
+ 1. Server sends no body
+ 2. Server sends a body
+"""
+############# File Definitions ###############################################
+File1 = "abababababababababababababababababababababababababababababababababab"
+File2 = "ababababababababababababababababababab"
+
+A_File = WgetFile ("File1", File1)
+B_File = WgetFile ("File1", File1)
+
+C_File = WgetFile ("File2", File2)
+D_File = WgetFile ("File2", File1)
+
+E_File = WgetFile ("File3", File1)
+
+WGET_OPTIONS = "-c"
+WGET_URLS = [["File1", "File2", "File3"]]
+
+Files = [[A_File, C_File, E_File]]
+Existing_Files = [B_File, D_File]
+
+ExpectedReturnCode = 0
+ExpectedDownloadedFiles = [B_File, D_File, E_File]
+
+################ Pre and Post Test Hooks #####################################
+pre_test = {
+ "ServerFiles" : Files,
+ "LocalFiles" : Existing_Files
+}
+test_options = {
+ "WgetCommands" : WGET_OPTIONS,
+ "Urls" : WGET_URLS
+}
+post_test = {
+ "ExpectedFiles" : ExpectedDownloadedFiles,
+ "ExpectedRetcode" : ExpectedReturnCode
+}
+
+err = HTTPTest (
+ pre_hook=pre_test,
+ test_params=test_options,
+ post_hook=post_test
+).begin ()
+
+exit (err)