Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/rpm-software-management/createrepo_c.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAleš Matěj <amatej@redhat.com>2020-07-24 13:53:47 +0300
committerNeal Gompa (ニール・ゴンパ) <ngompa13@gmail.com>2020-07-26 06:03:25 +0300
commit76b4a34e04f09596c92fa0326001f18891695e17 (patch)
treeaa876f7655769f40c73ce2a13ad1f8cba88defc2
parent074982bc3eb886d8b56d797d38c8a7f135d013a2 (diff)
Add a test for parsing huge snippet (RhBug:1859689)
https://bugzilla.redhat.com/show_bug.cgi?id=1859689
-rw-r--r--tests/python/tests/test_xml_parser.py36
1 files changed, 36 insertions, 0 deletions
diff --git a/tests/python/tests/test_xml_parser.py b/tests/python/tests/test_xml_parser.py
index e2c48f0..8856096 100644
--- a/tests/python/tests/test_xml_parser.py
+++ b/tests/python/tests/test_xml_parser.py
@@ -476,6 +476,42 @@ class TestCaseXmlParserFilelists(unittest.TestCase):
self.assertEqual(userdata["pkgcb_calls"], 2)
self.assertEqual(userdata["warnings"], [])
+ def test_xml_parser_filelists_snippet_huge(self):
+
+ userdata = {
+ "pkgs": [],
+ "pkgcb_calls": 0,
+ "warnings": []
+ }
+
+ def newpkgcb(pkgId, name, arch):
+ pkg = cr.Package()
+ userdata["pkgs"].append(pkg)
+ return pkg
+
+ def pkgcb(pkg):
+ userdata["pkgcb_calls"] += 1
+
+ def warningcb(warn_type, msg):
+ userdata["warnings"].append((warn_type, msg))
+
+ # generete huge filelists snippet
+ content = """
+ <package pkgid="68743563000b2a85e7d9d7ce318719217f3bfee6167cd862efd201ff96c1ecbb" name="flat-remix-icon-theme" arch="noarch">
+ <version epoch="0" ver="0.0.20200511" rel="1.fc33"/>
+ """
+ for i in range(145951):
+ content += "<file>/usr/share/icons/Flat-Remix-Yellow/status/symbolic/user-available-symbolic.svg</file>"
+ content += "</package>"
+
+ cr.xml_parse_filelists_snippet(content, newpkgcb, pkgcb, warningcb)
+
+ self.assertEqual([pkg.name for pkg in userdata["pkgs"]],
+ ['flat-remix-icon-theme'])
+ self.assertEqual(userdata["pkgcb_calls"], 1)
+ self.assertEqual(userdata["warnings"], [])
+
+
def test_xml_parser_filelists_repo02_only_pkgcb(self):