Changeset View
Changeset View
Standalone View
Standalone View
swh/web/tests/conftest.py
Show First 20 Lines • Show All 981 Lines • ▼ Show 20 Lines | def snapshot_get_head(self, snapshot): | ||||
else: | else: | ||||
head = snapshot["branches"]["HEAD"]["target"] | head = snapshot["branches"]["HEAD"]["target"] | ||||
return head | return head | ||||
def snapshot_count_branches(self, snapshot_id): | def snapshot_count_branches(self, snapshot_id): | ||||
counts = dict.fromkeys(("alias", "release", "revision"), 0) | counts = dict.fromkeys(("alias", "release", "revision"), 0) | ||||
counts.update(self.storage.snapshot_count_branches(hash_to_bytes(snapshot_id))) | counts.update(self.storage.snapshot_count_branches(hash_to_bytes(snapshot_id))) | ||||
counts.pop(None, None) | counts.pop(None, None) | ||||
counts["branch"] = sum( | |||||
counts.get(target_type, 0) | |||||
for target_type in ("content", "directory", "revision") | |||||
) | |||||
return counts | return counts | ||||
class _IndexerData: | class _IndexerData: | ||||
""" | """ | ||||
Helper class to manage indexer tests data | Helper class to manage indexer tests data | ||||
It is initialized with a reference to an in-memory indexer storage | It is initialized with a reference to an in-memory indexer storage | ||||
▲ Show 20 Lines • Show All 258 Lines • Show Last 20 Lines |