def test_checksum(self): import hashlib map_data = 'teh map data' hexdigest = hashlib.md5(map_data).hexdigest() path = (self.tmp / 'checksum') path.makedirs() (path / 'data.gml').write_text(map_data) self.assertEqual([(u'data.gml', hexdigest)], warehouse.checksum(path))
def fsck(): from warehouse import get_warehouse, checksum wh = get_warehouse() parcels = wh.get_all_parcels() for parcel in parcels: folder_path = parcel.get_path() files_checksum = checksum(folder_path) if not files_checksum == getattr(parcel, 'checksum', []): print "Checksum for parcel %r is wrong" % parcel.name print "Finished checking for parcel checksums"