def test_basic_metadata_parse(self):
     test_url = "http://repos.fedorapeople.org/repos/pulp/pulp/v1/testing/6Server/i386/"
     temp_label = "temp_label"
     temp_dir = tempfile.mkdtemp()
     try:
         yum_metadata_obj = YumMetadataObj(temp_label, test_url)
         pkglist = yum_metadata_obj.getDownloadItems(repo_dir=temp_dir)
         self.assertTrue(len(pkglist) > 0)
     finally:
         shutil.rmtree(temp_dir)
 def test_rpm_changelog_files_data(self):
     repo_dir = os.path.abspath(os.path.join(DATA_DIR, "repo_separate_pkg_dir"))
     test_url = "file://%s" % (repo_dir)
     temp_label = "temp_label"
     temp_dir = tempfile.mkdtemp()
     try:
         yum_metadata_obj = YumMetadataObj(temp_label, test_url)
         pkglist = yum_metadata_obj.getDownloadItems(repo_dir=temp_dir)
         self.assertTrue(pkglist.has_key("rpms"))
         self.assertEquals(len(pkglist["rpms"]), 2)
         pkg = pkglist["rpms"][0]
         self.assertTrue(pkg.has_key("changelog"))
         self.assertTrue(pkg.has_key("filelist"))
         self.assertTrue(pkg.has_key("files"))
         self.assertEquals(len(pkg['changelog']), 2)
         self.assertEquals(len(pkg['filelist']), 1)
         self.assertEquals(len(pkg['files']), 1)
     finally:
         shutil.rmtree(temp_dir)
 def test_xml_base_attribute_of_package_metadata(self):
     repo_dir = os.path.abspath(os.path.join(DATA_DIR, "repo_separate_pkg_dir"))
     test_url = "file://%s" % (repo_dir)
     temp_label = "temp_label"
     temp_dir = tempfile.mkdtemp()
     try:
         yum_metadata_obj = YumMetadataObj(temp_label, test_url)
         pkglist = yum_metadata_obj.getDownloadItems(repo_dir=temp_dir)
         self.assertTrue(pkglist.has_key("rpms"))
         self.assertEquals(len(pkglist["rpms"]), 2)
         pkg = pkglist["rpms"][0]
         print "pkg = %s" % (pkg)
         self.assertTrue(pkg.has_key("repodata"))
         self.assertTrue(pkg["repodata"].has_key("primary"))
         primary_xml_snippet = pkg["repodata"]["primary"]
         loc_start = primary_xml_snippet.find("<location")
         loc_end = primary_xml_snippet.find("/>", loc_start) + 2
         location = primary_xml_snippet[loc_start:loc_end]
         self.assertTrue(location)
         xml_base_index = location.find("xml:base")
         self.assertEquals(xml_base_index, -1)
     finally:
         shutil.rmtree(temp_dir)