コード例 #1
0
ファイル: test_util.py プロジェクト: pombredanne/DeltaRepo
    def test_contenthashcalculation_for_empty_primary(self):
        # Default checksum (sha256)
        ch = calculate_content_hash(fixtures.REPO_00_PRIMARY)
        self.assertEqual(ch, "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855")

        # sha - Classical creterepo says sha, but means sha1 so expect the value for sha1
        ch = calculate_content_hash(fixtures.REPO_00_PRIMARY, checksum_type="sha")
        self.assertEqual(ch, "da39a3ee5e6b4b0d3255bfef95601890afd80709")

        # sha1
        ch = calculate_content_hash(fixtures.REPO_00_PRIMARY, checksum_type="sha1")
        self.assertEqual(ch, "da39a3ee5e6b4b0d3255bfef95601890afd80709")

        # sha224
        ch = calculate_content_hash(fixtures.REPO_00_PRIMARY, checksum_type="sha224")
        self.assertEqual(ch, "d14a028c2a3a2bc9476102bb288234c415a2b01f828ea62ac5b3e42f")

        # sha512
        ch = calculate_content_hash(fixtures.REPO_00_PRIMARY, checksum_type="sha512")
        self.assertEqual(ch, "cf83e1357eefb8bdf1542850d66d8007d620e4050b5715dc83f4a921d36ce9ce47d0d13c5d85f2b0ff8318d2877eec2f63b931bd47417a81a538327af927da3e")
コード例 #2
0
ファイル: test_util.py プロジェクト: pombredanne/DeltaRepo
    def test_contenthashcalculation(self):
        # Default checksum (sha256)
        ch = calculate_content_hash(fixtures.REPO_01_PRIMARY)
        self.assertEqual(ch, "4d1c9f8b7c442adb5f90fda368ec7eb267fa42759a5d125001585bc8928b3967")

        # sha - Classical creterepo says sha, but means sha1 so expect the value for sha1
        ch = calculate_content_hash(fixtures.REPO_01_PRIMARY, checksum_type="sha")
        self.assertEqual(ch, "c35d59311257eff6890e79e48526f4cd2bf66113")

        # sha1
        ch = calculate_content_hash(fixtures.REPO_01_PRIMARY, checksum_type="sha1")
        self.assertEqual(ch, "c35d59311257eff6890e79e48526f4cd2bf66113")

        # sha224
        ch = calculate_content_hash(fixtures.REPO_01_PRIMARY, checksum_type="sha224")
        self.assertEqual(ch, "6bc0ac11a5e611ed5371c0a19a3ed18f3c965c7dba4c1911cb0f7e4e")

        # sha512
        ch = calculate_content_hash(fixtures.REPO_01_PRIMARY, checksum_type="sha512")
        self.assertEqual(ch, "882e705c2f95d222ae525295ff440b4da4d30a0a857062ece3c05cc2a45b32ecfadf5614613eecb222a01aea8e4cf91695eed54433afb0a27341ca061de18933")
コード例 #3
0
ファイル: test_util.py プロジェクト: pombredanne/DeltaRepo
 def test_contenthashcalculation_for_badfile(self):
     # Bad XML type (e.g. other.xml instead of primary.xml) should return the same hash as for empty file
     ch = calculate_content_hash(fixtures.DELTAREPOS_01)
     self.assertEqual(ch, "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855")