Esempio n. 1
0
 def test_download_save_as(self):
   file_list = ['/debian/README.html']
   ftpd = DirectHttpDownload('http', 'ftp2.fr.debian.org', '', file_list)
   ftpd.save_as = 'test.html'
   (file_list, dir_list) = ftpd.list()
   ftpd.download(self.utils.data_dir, False)
   ftpd.close()
   self.assertTrue(os.path.exists(os.path.join(self.utils.data_dir,'test.html')))
Esempio n. 2
0
 def test_download_save_as(self):
     file_list = ["/debian/README.html"]
     ftpd = DirectHttpDownload("http", "ftp2.fr.debian.org", "", file_list)
     ftpd.save_as = "test.html"
     (file_list, dir_list) = ftpd.list()
     ftpd.download(self.utils.data_dir, False)
     ftpd.close()
     self.assertTrue(os.path.exists(os.path.join(self.utils.data_dir, "test.html")))
Esempio n. 3
0
 def test_download_save_as(self):
     file_list = ['/debian/README.html']
     ftpd = DirectHttpDownload('http', 'ftp2.fr.debian.org', '', file_list)
     ftpd.save_as = 'test.html'
     (file_list, dir_list) = ftpd.list()
     ftpd.download(self.utils.data_dir, False)
     ftpd.close()
     self.assertTrue(
         os.path.exists(os.path.join(self.utils.data_dir, 'test.html')))
Esempio n. 4
0
 def test_download_get_params_save_as(self):
   file_list = ['/get']
   ftpd = DirectHttpDownload('http', 'httpbin.org', '', file_list)
   ftpd.param = { 'key1': 'value1', 'key2': 'value2'}
   ftpd.save_as = 'test.json'
   (file_list, dir_list) = ftpd.list()
   ftpd.download(self.utils.data_dir, False)
   ftpd.close()
   self.assertTrue(os.path.exists(os.path.join(self.utils.data_dir,'test.json')))
   with open(os.path.join(self.utils.data_dir,'test.json'), 'r') as content_file:
     content = content_file.read()
     my_json = json.loads(content)
     self.assertTrue(my_json['args']['key1'] == 'value1')
Esempio n. 5
0
 def test_download_get_params_save_as(self):
     file_list = ["/get"]
     ftpd = DirectHttpDownload("http", "httpbin.org", "", file_list)
     ftpd.param = {"key1": "value1", "key2": "value2"}
     ftpd.save_as = "test.json"
     (file_list, dir_list) = ftpd.list()
     ftpd.download(self.utils.data_dir, False)
     ftpd.close()
     self.assertTrue(os.path.exists(os.path.join(self.utils.data_dir, "test.json")))
     with open(os.path.join(self.utils.data_dir, "test.json"), "r") as content_file:
         content = content_file.read()
         my_json = json.loads(content)
         self.assertTrue(my_json["args"]["key1"] == "value1")
Esempio n. 6
0
 def test_download_get_params_save_as(self):
     file_list = ['/get']
     ftpd = DirectHttpDownload('http', 'httpbin.org', '', file_list)
     ftpd.param = {'key1': 'value1', 'key2': 'value2'}
     ftpd.save_as = 'test.json'
     (file_list, dir_list) = ftpd.list()
     ftpd.download(self.utils.data_dir, False)
     ftpd.close()
     self.assertTrue(
         os.path.exists(os.path.join(self.utils.data_dir, 'test.json')))
     with open(os.path.join(self.utils.data_dir, 'test.json'),
               'r') as content_file:
         content = content_file.read()
         my_json = json.loads(content)
         self.assertTrue(my_json['args']['key1'] == 'value1')
Esempio n. 7
0
 def test_download_post_params(self):
   #file_list = ['/debian/README.html']
   file_list = ['/post']
   ftpd = DirectHttpDownload('http', 'httpbin.org', '', file_list)
   #ftpd = DirectHttpDownload('http', 'ftp2.fr.debian.org', '', file_list)
   ftpd.param = { 'key1': 'value1', 'key2': 'value2'}
   ftpd.save_as = 'test.json'
   ftpd.method = 'POST'
   (file_list, dir_list) = ftpd.list()
   ftpd.download(self.utils.data_dir, False)
   ftpd.close()
   self.assertTrue(os.path.exists(os.path.join(self.utils.data_dir,'test.json')))
   with open(os.path.join(self.utils.data_dir,'test.json'), 'r') as content_file:
     content = content_file.read()
     my_json = json.loads(content)
     self.assertTrue(my_json['form']['key1'] == 'value1')
Esempio n. 8
0
 def test_download_post_params(self):
     # file_list = ['/debian/README.html']
     file_list = ["/post"]
     ftpd = DirectHttpDownload("http", "httpbin.org", "", file_list)
     # ftpd = DirectHttpDownload('http', 'ftp2.fr.debian.org', '', file_list)
     ftpd.param = {"key1": "value1", "key2": "value2"}
     ftpd.save_as = "test.json"
     ftpd.method = "POST"
     (file_list, dir_list) = ftpd.list()
     ftpd.download(self.utils.data_dir, False)
     ftpd.close()
     self.assertTrue(os.path.exists(os.path.join(self.utils.data_dir, "test.json")))
     with open(os.path.join(self.utils.data_dir, "test.json"), "r") as content_file:
         content = content_file.read()
         my_json = json.loads(content)
         self.assertTrue(my_json["form"]["key1"] == "value1")
Esempio n. 9
0
 def test_download_post_params(self):
     #file_list = ['/debian/README.html']
     file_list = ['/post']
     ftpd = DirectHttpDownload('http', 'httpbin.org', '', file_list)
     #ftpd = DirectHttpDownload('http', 'ftp2.fr.debian.org', '', file_list)
     ftpd.param = {'key1': 'value1', 'key2': 'value2'}
     ftpd.save_as = 'test.json'
     ftpd.method = 'POST'
     (file_list, dir_list) = ftpd.list()
     ftpd.download(self.utils.data_dir, False)
     ftpd.close()
     self.assertTrue(
         os.path.exists(os.path.join(self.utils.data_dir, 'test.json')))
     with open(os.path.join(self.utils.data_dir, 'test.json'),
               'r') as content_file:
         content = content_file.read()
         my_json = json.loads(content)
         self.assertTrue(my_json['form']['key1'] == 'value1')