Changeset View
Changeset View
Standalone View
Standalone View
swh/loader/core/tests/__init__.py
Show First 20 Lines • Show All 43 Lines • ▼ Show 20 Lines | def assertContentsOk(self, expected_contents): | ||||
missing = list(self.storage.content_missing( | missing = list(self.storage.content_missing( | ||||
{'sha1': hash_to_bytes(content_hash)} | {'sha1': hash_to_bytes(content_hash)} | ||||
for content_hash in expected_contents)) | for content_hash in expected_contents)) | ||||
self.assertEqual(missing, []) | self.assertEqual(missing, []) | ||||
def assertDirectoriesOk(self, expected_directories): | def assertDirectoriesOk(self, expected_directories): | ||||
self._assertCountOk('directory', len(expected_directories)) | self._assertCountOk('directory', len(expected_directories)) | ||||
missing = list(self.storage.directory_missing( | missing = list(self.storage.directory_missing( | ||||
dir_['id'] for dir_ in expected_directories)) | hash_to_bytes(dir_) for dir_ in expected_directories)) | ||||
self.assertEqual(missing, []) | self.assertEqual(missing, []) | ||||
def assertReleasesOk(self, expected_releases): | def assertReleasesOk(self, expected_releases): | ||||
"""Check the loader's releases match the expected releases. | """Check the loader's releases match the expected releases. | ||||
Args: | Args: | ||||
releases ([dict]): List of dictionaries representing swh releases. | releases (list): list of swh releases' identifiers. | ||||
""" | """ | ||||
self._assertCountOk('release', len(expected_releases)) | self._assertCountOk('release', len(expected_releases)) | ||||
missing = list(self.storage.releases_missing( | missing = list(self.storage.release_missing( | ||||
rel['id'] for rel in expected_releases)) | hash_to_bytes(rel) for rel in expected_releases)) | ||||
self.assertEqual(missing, []) | self.assertEqual(missing, []) | ||||
def assertRevisionsOk(self, expected_revisions): | def assertRevisionsOk(self, expected_revisions): | ||||
"""Check the loader's revisions match the expected revisions. | """Check the loader's revisions match the expected revisions. | ||||
Expects self.loader to be instantiated and ready to be | Expects self.loader to be instantiated and ready to be | ||||
inspected (meaning the loading took place). | inspected (meaning the loading took place). | ||||
▲ Show 20 Lines • Show All 146 Lines • Show Last 20 Lines |