def testDeletesDEXFiles(self): clean.clean(self.reflector) cache = self.reflector.klass.context.cache.files self.assertEqual(cache[0].toString(), "---", "DEX File not deleted: %s" % cache[0].toString()) self.assertEqual(cache[2].toString(), "---", "DEX File not deleted: %s" % cache[2].toString())
def testDoesNotDeleteOtherFiles(self): clean.clean(self.reflector) cache = self.reflector.klass.context.cache.files self.assertNotEqual(cache[4].toString(), "---", "non DEX File deleted: %s" % cache[4].toString()) self.assertNotEqual(cache[5].toString(), "---", "non DEX File deleted: %s" % cache[5].toString()) self.assertNotEqual(cache[6].toString(), "---", "non APK File deleted: %s" % cache[6].toString()) self.assertNotEqual(cache[7].toString(), "---", "non DEX File deleted: %s" % cache[7].toString()) self.assertNotEqual(cache[8].toString(), "---", "non APK File deleted: %s" % cache[8].toString())
def do_clean(self, args): """ usage: clean Cleans APK and DEX files from drozer's cache. During normal operation, drozer uploads a number of APK files to your device, and extracts the DEX bytecode from others already on your device. This can start to consume a large amount of space, particularly if you are developing drozer modules. The `clean` command removes all of these cached files for you. drozer will automatically re-upload any files that it needs as you continue to use it. """ files = clean.clean(self.reflector) self.stdout.write("Removed %d cached files.\n" % files)
def testDeletedFilesCount(self): cleaned = clean.clean(self.reflector) self.assertEqual(cleaned, 4, "Incorrect Value Returned: %d" % cleaned)
def testException(self): with self.assertRaises(AttributeError): clean.clean(None)