def test_md5_compress(self): folder = temp_folder() save(os.path.join(folder, "one_file.txt"), b"The contents") save(os.path.join(folder, "Two_file.txt"), b"Two contents") files = { "one_file.txt": os.path.join(folder, "one_file.txt"), "Two_file.txt": os.path.join(folder, "Two_file.txt"), } compress_files(files, {}, PACKAGE_TGZ_NAME, dest_dir=folder) file_path = os.path.join(folder, PACKAGE_TGZ_NAME) md5_a = md5sum(file_path) self.assertEqual(md5_a, "df220cfbc0652e8992a89a77666c03b5") time.sleep(1) # Timestamps change folder = temp_folder() compress_files(files, {}, PACKAGE_TGZ_NAME, dest_dir=folder) file_path = os.path.join(folder, PACKAGE_TGZ_NAME) md5_b = md5sum(file_path) self.assertEquals(md5_a, md5_b)
def testMd5Name(self): files = { "one_file.txt": { "contents": b"The contents", "mode": 0o777 }, "Two_file.txt": { "contents": b"Two contents", "mode": 0o777 } } new_files = compress_files(files, PACKAGE_TGZ_NAME, excluded=[]) folder = temp_folder() file_path = os.path.join(folder, PACKAGE_TGZ_NAME) save(file_path, new_files[PACKAGE_TGZ_NAME]) md5_a = md5sum(file_path) time.sleep(1) # Timestamps change new_files = compress_files(files, PACKAGE_TGZ_NAME, excluded=[]) folder = temp_folder() file_path = os.path.join(folder, PACKAGE_TGZ_NAME) save(file_path, new_files[PACKAGE_TGZ_NAME]) md5_b = md5sum(file_path) self.assertEquals(md5_a, md5_b)
def testMd5Name(self): folder = temp_folder() save(os.path.join(folder, "one_file.txt"), b"The contents") save(os.path.join(folder, "Two_file.txt"), b"Two contents") files = { "one_file.txt": os.path.join(folder, "one_file.txt"), "Two_file.txt": os.path.join(folder, "Two_file.txt"), } compress_files(files, PACKAGE_TGZ_NAME, excluded=[PACKAGE_TGZ_NAME], dest_dir=folder) file_path = os.path.join(folder, PACKAGE_TGZ_NAME) md5_a = md5sum(file_path) time.sleep(1) # Timestamps change folder = temp_folder() compress_files(files, PACKAGE_TGZ_NAME, excluded=[PACKAGE_TGZ_NAME], dest_dir=folder) file_path = os.path.join(folder, PACKAGE_TGZ_NAME) md5_b = md5sum(file_path) self.assertEquals(md5_a, md5_b)
def test_compress_files(self): folder = temp_folder() save(os.path.join(folder, "one_file.txt"), b"The contents") save(os.path.join(folder, "Two_file.txt"), b"Two contents") files = { "one_file.txt": os.path.join(folder, "one_file.txt"), "Two_file.txt": os.path.join(folder, "Two_file.txt"), } path = compress_files(files, {}, PACKAGE_TGZ_NAME, dest_dir=folder) self.assertTrue(os.path.exists(path)) expected_path = os.path.join(folder, PACKAGE_TGZ_NAME) self.assertEqual(path, expected_path)