コード例 #1
0
ファイル: biomaj_tests.py プロジェクト: Nurtal/TRASHEXCHANGE
 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')))
コード例 #2
0
ファイル: biomaj_tests.py プロジェクト: pfem-bioinfo/biomaj
 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")))
コード例 #3
0
ファイル: biomaj_tests.py プロジェクト: lecorguille/biomaj
 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')))
コード例 #4
0
ファイル: biomaj_tests.py プロジェクト: Nurtal/TRASHEXCHANGE
 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')
コード例 #5
0
ファイル: biomaj_tests.py プロジェクト: pfem-bioinfo/biomaj
 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")
コード例 #6
0
ファイル: biomaj_tests.py プロジェクト: lecorguille/biomaj
 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')
コード例 #7
0
ファイル: biomaj_tests.py プロジェクト: Nurtal/TRASHEXCHANGE
 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')
コード例 #8
0
ファイル: biomaj_tests.py プロジェクト: pfem-bioinfo/biomaj
 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")
コード例 #9
0
ファイル: biomaj_tests.py プロジェクト: lecorguille/biomaj
 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')