diff --git a/swh/storage/cassandra/storage.py b/swh/storage/cassandra/storage.py --- a/swh/storage/cassandra/storage.py +++ b/swh/storage/cassandra/storage.py @@ -303,7 +303,7 @@ self, contents: List[Sha1Git] ) -> Iterable[Sha1Git]: return self.content_missing( - [{"sha1_git": c for c in contents}], key_hash="sha1_git" + [{"sha1_git": c} for c in contents], key_hash="sha1_git" ) def content_get_random(self) -> Sha1Git: diff --git a/swh/storage/tests/storage_tests.py b/swh/storage/tests/storage_tests.py --- a/swh/storage/tests/storage_tests.py +++ b/swh/storage/tests/storage_tests.py @@ -499,13 +499,22 @@ def test_content_missing_per_sha1_git(self, swh_storage, sample_data): cont, cont2 = sample_data.contents[:2] missing_cont = sample_data.skipped_content + missing_cont2 = sample_data.skipped_content2 swh_storage.content_add([cont, cont2]) - contents = [cont.sha1_git, cont2.sha1_git, missing_cont.sha1_git] + contents = [ + cont.sha1_git, + cont2.sha1_git, + missing_cont.sha1_git, + missing_cont2.sha1_git, + ] missing_contents = swh_storage.content_missing_per_sha1_git(contents) - assert list(missing_contents) == [missing_cont.sha1_git] + assert list(missing_contents) == [missing_cont.sha1_git, missing_cont2.sha1_git] + + missing_contents = swh_storage.content_missing_per_sha1_git([]) + assert list(missing_contents) == [] def test_content_get_partition(self, swh_storage, swh_contents): """content_get_partition paginates results if limit exceeded"""