def test_deltareposrecord_from_valid_deltarepo(self): rec = deltareposrecord_from_repopath(fixtures.DELTAREPO_01_02) # Check values parsed from repo's deltametadata.xml self.assertEqual(rec.location_base, None) self.assertEqual(rec.location_href, fixtures.DELTAREPO_01_02) self.assertEqual(rec.revision_src, "1378724582") self.assertEqual(rec.revision_dst, "1413550726") self.assertEqual(rec.contenthash_src, "4d1c9f8b7c442adb5f90fda368ec7eb267fa42759a5d125001585bc8928b3967") self.assertEqual(rec.contenthash_dst, "29ff875f99fe44a4b697ffe19bee5e874b5c61c5b0517f7f0772caae292b2bf7") self.assertEqual(rec.contenthash_type, "sha256") self.assertEqual(rec.timestamp_src, 1378724581) self.assertEqual(rec.timestamp_dst, 1413550726) # Check values calculated for repo's repomd.xml repomd_path = os.path.join(fixtures.DELTAREPO_01_02, "repodata", "repomd.xml") self.assertEqual(rec.repomd_timestamp, int(os.path.getmtime(repomd_path))) self.assertEqual(rec.repomd_size, os.path.getsize(repomd_path)) checksumval = compute_file_checksum(repomd_path) self.assertEqual(rec.repomd_checksums, [("sha256", checksumval)])
def test_deltareposrecord_from_valid_deltarepo_with_path_prefix(self): rec = deltareposrecord_from_repopath(fixtures.DELTAREPO_01_02, prefix_to_strip=os.path.dirname(fixtures.DELTAREPO_01_02)) self.assertEqual(rec.location_base, None) self.assertEqual(rec.location_href, os.path.basename(fixtures.DELTAREPO_01_02))