python: Add default params for xml_parser_* functions.
authorTomas Mlcoch <tmlcoch@redhat.com>
Tue, 4 Jun 2013 11:43:11 +0000 (13:43 +0200)
committerTomas Mlcoch <tmlcoch@redhat.com>
Tue, 4 Jun 2013 11:43:11 +0000 (13:43 +0200)
src/python/__init__.py
tests/python/tests/test_xml_parser.py

index e0ae838..df39a35 100644 (file)
@@ -68,7 +68,10 @@ Repomd = _createrepo_c.Repomd
 class RepomdRecord(_createrepo_c.RepomdRecord):
     def compress_and_fill(self, hashtype, compresstype):
         rec = RepomdRecord(self.type + "_gz", None)
-        _createrepo_c.RepomdRecord.compress_and_fill(self, rec, hashtype, compresstype)
+        _createrepo_c.RepomdRecord.compress_and_fill(self,
+                                                     rec,
+                                                     hashtype,
+                                                     compresstype)
         return rec
 
 
@@ -110,10 +113,6 @@ xml_dump_primary    = _createrepo_c.xml_dump_primary
 xml_dump_filelists  = _createrepo_c.xml_dump_filelists
 xml_dump_other      = _createrepo_c.xml_dump_other
 xml_dump            = _createrepo_c.xml_dump
-xml_parse_primary   = _createrepo_c.xml_parse_primary
-xml_parse_filelists = _createrepo_c.xml_parse_filelists
-xml_parse_other     = _createrepo_c.xml_parse_other
-xml_parse_repomd    = _createrepo_c.xml_parse_repomd
 
 def package_from_rpm(filename, checksum_type=SHA256, location_href=None,
                      location_base=None, changelog_limit=10):
@@ -124,3 +123,17 @@ def xml_from_rpm(filename, checksum_type=SHA256, location_href=None,
                      location_base=None, changelog_limit=10):
     return _createrepo_c.xml_from_rpm(filename, checksum_type,
                       location_href, location_base, changelog_limit)
+
+def xml_parse_primary(path, newpkgcb=None, pkgcb=None,
+                      warningcb=None, do_files=1):
+    return _createrepo_c.xml_parse_primary(path, newpkgcb, pkgcb,
+                                           warningcb, do_files)
+
+def xml_parse_filelists(path, newpkgcb=None, pkgcb=None, warningcb=None):
+    return _createrepo_c.xml_parse_filelists(path, newpkgcb, pkgcb, warningcb)
+
+def xml_parse_other(path, newpkgcb=None, pkgcb=None, warningcb=None):
+    return _createrepo_c.xml_parse_other(path, newpkgcb, pkgcb, warningcb)
+
+def xml_parse_repomd(path, repomdobj, warning_cb=None):
+    return _createrepo_c.xml_parse_repomd(path, repomdobj, warning_cb)
index 4fd42c9..09341ad 100644 (file)
@@ -615,3 +615,14 @@ class TestCaseXmlParserRepomd(unittest.TestCase):
         self.assertEqual(repomd.records[2].size, 782)
         self.assertEqual(repomd.records[2].size_open, 2085)
         self.assertEqual(repomd.records[2].db_ver, 0)
+
+    def test_xml_parser_repomd_repo01_nowarningcb(self):
+
+        repomd = cr.Repomd()
+        cr.xml_parse_repomd(REPO_01_REPOMD, repomd)
+        self.assertEqual(repomd.revision, "1334667230")
+        self.assertEqual(repomd.repo_tags, [])
+        self.assertEqual(repomd.distro_tags, [])
+        self.assertEqual(repomd.content_tags, [])
+        self.assertEqual(len(repomd.records), 3)
+