Changeset View
Changeset View
Standalone View
Standalone View
swh/storage/tests/test_storage.py
Show First 20 Lines • Show All 324 Lines • ▼ Show 20 Lines | def test_content_add_collision(self, swh_storage): | ||||
content_hex_hashes(Content.from_dict(cont1).hashes()), | content_hex_hashes(Content.from_dict(cont1).hashes()), | ||||
content_hex_hashes(Content.from_dict(cont1b).hashes()) | content_hex_hashes(Content.from_dict(cont1b).hashes()) | ||||
] | ] | ||||
assert exc.colliding_content_hashes() == [ | assert exc.colliding_content_hashes() == [ | ||||
Content.from_dict(cont1).hashes(), | Content.from_dict(cont1).hashes(), | ||||
Content.from_dict(cont1b).hashes() | Content.from_dict(cont1b).hashes() | ||||
] | ] | ||||
def test_content_add_duplicate(self, swh_storage): | |||||
swh_storage.content_add([data.cont, data.cont]) | |||||
assert list(swh_storage.content_get([data.cont['sha1']])) == \ | |||||
[{'sha1': data.cont['sha1'], 'data': data.cont['data']}] | |||||
def test_content_update(self, swh_storage): | def test_content_update(self, swh_storage): | ||||
if hasattr(swh_storage, 'storage'): | if hasattr(swh_storage, 'storage'): | ||||
swh_storage.journal_writer.journal = None # TODO, not supported | swh_storage.journal_writer.journal = None # TODO, not supported | ||||
cont = copy.deepcopy(data.cont) | cont = copy.deepcopy(data.cont) | ||||
swh_storage.content_add([cont]) | swh_storage.content_add([cont]) | ||||
# alter the sha1_git for example | # alter the sha1_git for example | ||||
▲ Show 20 Lines • Show All 3,556 Lines • Show Last 20 Lines |