def testResourceRemovedOutside(self): resource, img, idevice = self.prepareTestPackage() resource.path.remove() checker = Checker(self.package) inconsistencies = checker.check() assert len(inconsistencies) == 1 for inconsistency in inconsistencies: #log.info('Pre Fix package resources: %s' % self.package.resources) #log.info('Pre Fix idevice resources: %s' % idevice.userResources) inconsistency.fix() #log.info('Post Fix package resources: %s' % self.package.resources) #log.info('Post Fix idevice resources: %s' % idevice.userResources) assert resource.checksum not in self.package.resources assert resource not in idevice.userResources
def testResourceChangedOutside(self): resource, img, idevice = self.prepareTestPackage() resource.path.write_bytes('a', append=False) assert resource.path.md5 not in self.package.resources checker = Checker(self.package, clear=False) inconsistencies = checker.check() assert len(inconsistencies) == 3 for inconsistency in inconsistencies: #log.info('Pre Fix package resources: %s' % self.package.resources) #log.info('Pre Fix idevice resources: %s' % idevice.userResources) inconsistency.fix() #log.info('Post Fix package resources: %s' % self.package.resources) #log.info('Post Fix idevice resources: %s' % idevice.userResources) assert img.md5 not in self.package.resources assert resource.path.md5 in self.package.resources assert resource not in idevice.userResources assert len(self.package.resources[resource.path.md5]) == 1 assert self.package.resources[resource.path.md5][0] in idevice.userResources
def testResourceChangedOutside(self): resource, img, idevice = self.prepareTestPackage() resource.path.write_bytes('a', append=False) assert resource.path.md5 not in self.package.resources checker = Checker(self.package, clear=False) inconsistencies = checker.check() assert len(inconsistencies) == 3 for inconsistency in inconsistencies: #log.info('Pre Fix package resources: %s' % self.package.resources) #log.info('Pre Fix idevice resources: %s' % idevice.userResources) inconsistency.fix() #log.info('Post Fix package resources: %s' % self.package.resources) #log.info('Post Fix idevice resources: %s' % idevice.userResources) assert img.md5 not in self.package.resources assert resource.path.md5 in self.package.resources assert resource not in idevice.userResources assert len(self.package.resources[resource.path.md5]) == 1 assert self.package.resources[ resource.path.md5][0] in idevice.userResources
def testCheckVoidPackage(self): self.prepareTestPackage() checker = Checker(self.package) inconsistencies = checker.check() assert not inconsistencies