Changeset View
Changeset View
Standalone View
Standalone View
swh/storage/tests/test_storage.py
Show First 20 Lines • Show All 2,867 Lines • ▼ Show 20 Lines | def test_object_find_by_sha1_git(self, swh_storage): | ||||
b'00000000000000000000': [], | b'00000000000000000000': [], | ||||
} | } | ||||
swh_storage.content_add([data.cont]) | swh_storage.content_add([data.cont]) | ||||
sha1_gits.append(data.cont['sha1_git']) | sha1_gits.append(data.cont['sha1_git']) | ||||
expected[data.cont['sha1_git']] = [{ | expected[data.cont['sha1_git']] = [{ | ||||
'sha1_git': data.cont['sha1_git'], | 'sha1_git': data.cont['sha1_git'], | ||||
'type': 'content', | 'type': 'content', | ||||
'id': data.cont['sha1'], | |||||
}] | }] | ||||
swh_storage.directory_add([data.dir]) | swh_storage.directory_add([data.dir]) | ||||
sha1_gits.append(data.dir['id']) | sha1_gits.append(data.dir['id']) | ||||
expected[data.dir['id']] = [{ | expected[data.dir['id']] = [{ | ||||
'sha1_git': data.dir['id'], | 'sha1_git': data.dir['id'], | ||||
'type': 'directory', | 'type': 'directory', | ||||
'id': data.dir['id'], | |||||
}] | }] | ||||
swh_storage.revision_add([data.revision]) | swh_storage.revision_add([data.revision]) | ||||
sha1_gits.append(data.revision['id']) | sha1_gits.append(data.revision['id']) | ||||
expected[data.revision['id']] = [{ | expected[data.revision['id']] = [{ | ||||
'sha1_git': data.revision['id'], | 'sha1_git': data.revision['id'], | ||||
'type': 'revision', | 'type': 'revision', | ||||
'id': data.revision['id'], | |||||
}] | }] | ||||
swh_storage.release_add([data.release]) | swh_storage.release_add([data.release]) | ||||
sha1_gits.append(data.release['id']) | sha1_gits.append(data.release['id']) | ||||
expected[data.release['id']] = [{ | expected[data.release['id']] = [{ | ||||
'sha1_git': data.release['id'], | 'sha1_git': data.release['id'], | ||||
'type': 'release', | 'type': 'release', | ||||
'id': data.release['id'], | |||||
}] | }] | ||||
ret = swh_storage.object_find_by_sha1_git(sha1_gits) | ret = swh_storage.object_find_by_sha1_git(sha1_gits) | ||||
for val in ret.values(): | |||||
for obj in val: | |||||
if 'object_id' in obj: | |||||
del obj['object_id'] | |||||
assert expected == ret | assert expected == ret | ||||
def test_tool_add(self, swh_storage): | def test_tool_add(self, swh_storage): | ||||
tool = { | tool = { | ||||
'name': 'some-unknown-tool', | 'name': 'some-unknown-tool', | ||||
'version': 'some-version', | 'version': 'some-version', | ||||
'configuration': {"debian-package": "some-package"}, | 'configuration': {"debian-package": "some-package"}, | ||||
▲ Show 20 Lines • Show All 824 Lines • Show Last 20 Lines |