def test_obfuscation_build_obfuscated_apk_error( self, tmp_demo_apk_v10_original_path: str): obfuscation = Obfuscation(tmp_demo_apk_v10_original_path) obfuscation._is_decoded = True obfuscation._decoded_apk_path = "invalid.decoded.apk.path" with pytest.raises(Exception): obfuscation.build_obfuscated_apk()
def obfuscate(self, obfuscation_info: Obfuscation): self.logger.info('Running "{0}" obfuscator'.format(self.__class__.__name__)) try: obfuscation_info.build_obfuscated_apk() except Exception as e: self.logger.error('Error during execution of "{0}" obfuscator: {1}'.format(self.__class__.__name__, e)) raise finally: obfuscation_info.used_obfuscators.append(self.__class__.__name__)
def test_obfuscation_build_obfuscated_apk_success( self, tmp_working_directory_path: str, tmp_demo_apk_v10_original_path: str, ): obfuscated_apk_path = os.path.join(tmp_working_directory_path, "obfuscated.apk") obfuscation = Obfuscation( tmp_demo_apk_v10_original_path, tmp_working_directory_path, obfuscated_apk_path, ) assert not os.path.isfile(obfuscated_apk_path) obfuscation.build_obfuscated_apk() assert os.path.isfile(obfuscated_apk_path)