Changeset View
Changeset View
Standalone View
Standalone View
swh/storage/tests/test_storage.py
Show First 20 Lines • Show All 2,488 Lines • ▼ Show 20 Lines | |||||
def test_content_find_with_non_present_content(self): | def test_content_find_with_non_present_content(self): | ||||
# 1. with something that does not exist | # 1. with something that does not exist | ||||
missing_cont = self.missing_cont | missing_cont = self.missing_cont | ||||
actually_present = self.storage.content_find( | actually_present = self.storage.content_find( | ||||
{'sha1': missing_cont['sha1']}) | {'sha1': missing_cont['sha1']}) | ||||
self.assertIsNone(actually_present) | self.assertEqual(actually_present, []) | ||||
# 2. with something that does not exist | # 2. with something that does not exist | ||||
actually_present = self.storage.content_find( | actually_present = self.storage.content_find( | ||||
{'sha1_git': missing_cont['sha1_git']}) | {'sha1_git': missing_cont['sha1_git']}) | ||||
self.assertIsNone(actually_present) | self.assertEqual(actually_present, []) | ||||
# 3. with something that does not exist | # 3. with something that does not exist | ||||
actually_present = self.storage.content_find( | actually_present = self.storage.content_find( | ||||
{'sha256': missing_cont['sha256']}) | {'sha256': missing_cont['sha256']}) | ||||
self.assertIsNone(actually_present) | self.assertEqual(actually_present, []) | ||||
def test_content_find_with_duplicate_input(self): | def test_content_find_with_duplicate_input(self): | ||||
cont1 = self.cont | cont1 = self.cont | ||||
duplicate_cont = cont1.copy() | duplicate_cont = cont1.copy() | ||||
# Create fake data with colliding sha256 and blake2s256 | # Create fake data with colliding sha256 and blake2s256 | ||||
sha1_array = bytearray(duplicate_cont['sha1']) | sha1_array = bytearray(duplicate_cont['sha1']) | ||||
sha1_array[0] += 1 | sha1_array[0] += 1 | ||||
▲ Show 20 Lines • Show All 812 Lines • Show Last 20 Lines |