Changeset View
Changeset View
Standalone View
Standalone View
swh/indexer/tests/test_utils.py
Show First 20 Lines • Show All 351 Lines • ▼ Show 20 Lines | def revision_metadata_add(self, metadata, conflict_update=None): | ||||
self.revision_metadata.setdefault(item['id'], []).append(item) | self.revision_metadata.setdefault(item['id'], []).append(item) | ||||
def revision_metadata_get(self, ids): | def revision_metadata_get(self, ids): | ||||
for id_ in ids: | for id_ in ids: | ||||
assert isinstance(id_, bytes) | assert isinstance(id_, bytes) | ||||
for item in self.revision_metadata.get(id_): | for item in self.revision_metadata.get(id_): | ||||
item = item.copy() | item = item.copy() | ||||
tool_id = item.pop('indexer_configuration_id') | tool_id = item.pop('indexer_configuration_id') | ||||
if tool_id in self.tools: | |||||
item['tool'] = self.tools[tool_id].copy() | item['tool'] = self.tools[tool_id].copy() | ||||
else: # HACK: this needs to be removed altogether | |||||
item['tool'] = { | |||||
'id': tool_id, | |||||
'name': tool_id[0], | |||||
'version': tool_id[1], | |||||
'configuration': tool_id[2], | |||||
vlorentz: No, that should raise an error. | |||||
Done Inline ActionsIn that case, the tests simply won't work. That's a test initialization issue. All this class should go away as that's not tractable in the current state. ardumont: In that case, the tests simply won't work.
the tool_id does not exist.
That's a test… | |||||
} | |||||
yield item | yield item | ||||
def origin_intrinsic_metadata_add(self, metadata, conflict_update=None): | def origin_intrinsic_metadata_add(self, metadata, conflict_update=None): | ||||
self.added_data.append( | self.added_data.append( | ||||
('origin_intrinsic_metadata', conflict_update, metadata)) | ('origin_intrinsic_metadata', conflict_update, metadata)) | ||||
def content_metadata_get(self, sha1s): | def content_metadata_get(self, sha1s): | ||||
return [{ | return [{ | ||||
▲ Show 20 Lines • Show All 396 Lines • Show Last 20 Lines |
No, that should raise an error.