Skip to content

Instantly share code, notes, and snippets.

@satyamz
Last active August 29, 2015 14:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save satyamz/cbcee17231132a8e2233 to your computer and use it in GitHub Desktop.
Save satyamz/cbcee17231132a8e2233 to your computer and use it in GitHub Desktop.
#!/usr/bin/env python3
from sys import exit
from test.ftp_test import FTPTest
from test.base_test import FTP
from misc.wget_file import WgetFile
import os
"""
This test ensures that Wget recursive download from FTP Server
"""
TEST_NAME = "FTP Recursive Downloads"
########## File Definitions #####################################
File1 = "Beyond the fog lies clarity"
File2 = "I know you!"
File3 = "Dreams come true" #This file is present under /Foo
#Foo = { "File3" : "Dreams come true" }
A_File = WgetFile ("File1", File1)
B_File = WgetFile ("File2", File2)
C_File = WgetFile ("File3", File3)
Foo = []
Foo.append(C_File)
D_Directory = WgetFile ("Foo", Foo)
WGET_OPTIONS = " -r "
WGET_URLS = [["Foo/File3"]]
Files = [[A_File, B_File, D_Directory]]
Servers = [FTP]
ExpectedReturnCode = 0
ExpectedDownloadedFiles = [C_File]
######### Pre and Post Test Hooks ################################
pre_test = {
"ServerFiles" : Files
}
test_options = {
"WgetCommands" : WGET_OPTIONS,
"Urls" : WGET_URLS
}
post_test = {
"ExpectedFiles" : ExpectedDownloadedFiles,
"ExpectedRetCode" : ExpectedReturnCode
}
err = FTPTest (
name=TEST_NAME,
pre_hook=pre_test,
test_params=test_options,
post_hooks=post_test,
protocols=Servers
).begin ()
exit (err)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment