Exemple #1
0
 def test_http_get_binary_file_absent(self):
     """Test HTTP GET request and write to binary file when it does not exist"""
     filepath = os.path.join('testfiles', 'testdir', 'test.tar.gz')
     if file_exists(filepath):
         os.remove(filepath)
     http = HTTP("https://github.com/chrissimpkins/six-four/tarball/master")
     http.get_bin_write_file(filepath)
     self.assertTrue(file_exists(filepath))
Exemple #2
0
 def test_http_get_binary_file_absent(self):
     """Test HTTP GET request and write to binary file when it does not exist"""
     filepath = os.path.join('testfiles', 'testdir', 'test.tar.gz')
     if file_exists(filepath):
         os.remove(filepath)
     http = HTTP(
         "https://github.com/chrissimpkins/six-four/tarball/master")
     http.get_bin_write_file(filepath)
     self.assertTrue(file_exists(filepath))
Exemple #3
0
 def test_http_get_binary_file_exists_request_overwrite(self):
     """Test HTTP GET request and write binary file executes the write when the file exists and overwrite requested"""
     filepath = os.path.join('testfiles', 'testdir', 'test.tar.gz')
     fw = FileWriter(filepath)
     fw.write("test")
     if not file_exists(filepath):
         raise RuntimeError("Missing test file for the unit test")
     http = HTTP("https://github.com/chrissimpkins/six-four/tarball/master")
     http.get_bin_write_file(filepath, overwrite_existing=True)
     self.assertTrue(file_exists(filepath))
Exemple #4
0
 def test_http_get_binary_file_exists_request_overwrite(self):
     """Test HTTP GET request and write binary file executes the write when the file exists and overwrite requested"""
     filepath = os.path.join('testfiles', 'testdir', 'test.tar.gz')
     fw = FileWriter(filepath)
     fw.write("test")
     if not file_exists(filepath):
         raise RuntimeError("Missing test file for the unit test")
     http = HTTP(
         "https://github.com/chrissimpkins/six-four/tarball/master")
     http.get_bin_write_file(filepath, overwrite_existing=True)
     self.assertTrue(file_exists(filepath))
Exemple #5
0
 def test_http_get_binary_file_exists(self):
     """Test HTTP GET request and write to binary file when it does exist - should not overwrite by default"""
     filepath = os.path.join('testfiles', 'keep', 'test.tar.gz')
     if not file_exists(filepath):
         raise RuntimeError("Missing test file for the unit test")
     http = HTTP("https://github.com/chrissimpkins/six-four/tarball/master")
     self.assertFalse(http.get_bin_write_file(filepath)) # should not overwrite file by default
Exemple #6
0
 def test_http_get_binary_file_exists(self):
     """Test HTTP GET request and write to binary file when it does exist - should not overwrite by default"""
     filepath = os.path.join('testfiles', 'keep', 'test.tar.gz')
     if not file_exists(filepath):
         raise RuntimeError("Missing test file for the unit test")
     http = HTTP(
         "https://github.com/chrissimpkins/six-four/tarball/master")
     self.assertFalse(http.get_bin_write_file(
         filepath))  # should not overwrite file by default