本文整理汇总了Python中androguard.core.bytecodes.apk.APK.new_zip方法的典型用法代码示例。如果您正苦于以下问题:Python APK.new_zip方法的具体用法?Python APK.new_zip怎么用?Python APK.new_zip使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类androguard.core.bytecodes.apk.APK
的用法示例。
在下文中一共展示了APK.new_zip方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: testNewZipWithNewFile
# 需要导入模块: from androguard.core.bytecodes.apk import APK [as 别名]
# 或者: from androguard.core.bytecodes.apk.APK import new_zip [as 别名]
def testNewZipWithNewFile(self):
from androguard.core.bytecodes.apk import APK
try:
from unittest.mock import patch, MagicMock
except:
from mock import patch, MagicMock
a = APK("examples/tests/a2dp.Vol_137.apk", testzip=True)
with patch('zipfile.ZipFile') as zipFile:
mockZip = MagicMock()
zipFile.return_value=mockZip
a.new_zip("testout.apk", new_files={'res/menu/menu.xml': 'content'})
self.assertTrue(mockZip.writestr.call_count == 48)
self.assertTrue(mockZip.close.called)
示例2: testNewZipWithoutModification
# 需要导入模块: from androguard.core.bytecodes.apk import APK [as 别名]
# 或者: from androguard.core.bytecodes.apk.APK import new_zip [as 别名]
def testNewZipWithoutModification(self):
from androguard.core.bytecodes.apk import APK
try:
from unittest.mock import patch, MagicMock
except:
from mock import patch, MagicMock
a = APK("examples/tests/a2dp.Vol_137.apk", testzip=True)
with patch('zipfile.ZipFile') as zipFile:
mockZip = MagicMock()
zipFile.return_value=mockZip
a.new_zip("testout.apk")
self.assertEqual(mockZip.writestr.call_count, 48)
self.assertTrue(mockZip.close.called)