def test_encrypt_archive(self): debug_collector = DebugInfoCollector(include_logs=True, include_configs=True, include_content=True, include_system_info=True) plaintext_archive_path = debug_collector.create_archive() plaintext_archive_size = os.stat(plaintext_archive_path).st_size encrypted_archive_path = debug_collector.encrypt_archive( archive_file_path=plaintext_archive_path) encrypt_archive_size = os.stat(encrypted_archive_path).st_size self.assertTrue(os.path.isfile(encrypted_archive_path)) self.assertTrue(encrypt_archive_size > plaintext_archive_size) self.assertRaises(Exception, archive_path=encrypted_archive_path, extract_path='/tmp')
def test_encrypt_archive_with_custom_gpg_key(self): yaml_config = self._get_yaml_config() debug_collector = DebugInfoCollector(include_logs=True, include_configs=True, include_content=True, include_system_info=True, include_shell_commands=True, config_file=yaml_config) plaintext_archive_path = debug_collector.create_archive() plaintext_archive_size = os.stat(plaintext_archive_path).st_size encrypted_archive_path = debug_collector.encrypt_archive( archive_file_path=plaintext_archive_path) encrypt_archive_size = os.stat(encrypted_archive_path).st_size self.assertTrue(os.path.isfile(encrypted_archive_path)) self.assertTrue(encrypt_archive_size > plaintext_archive_size) self.assertRaises(Exception, archive_path=encrypted_archive_path, extract_path='/tmp')