From: Panu Matilainen Date: Thu, 9 Jun 2011 10:44:10 +0000 (+0300) Subject: Add a bunch of db match/key iterator test-cases in python X-Git-Tag: tznext/4.11.0.1.tizen20130304~1013 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=62bcf28ca442a77ec90a4fd13cf1280b4ab4d713;p=tools%2Flibrpm-tizen.git Add a bunch of db match/key iterator test-cases in python - This would've caught the breakage introduced in commit 7e4415fcc5e11cfd4cd9d0dfe19568be73f15d74, but better late than never... --- diff --git a/tests/rpmpython.at b/tests/rpmpython.at index a2a545d..262d272 100644 --- a/tests/rpmpython.at +++ b/tests/rpmpython.at @@ -40,3 +40,75 @@ for e in ts: ], [foo-1.0-1.noarch] ) + +AT_SETUP([database iterators]) +AT_KEYWORDS([python rpmdb]) +AT_CHECK([ +RPMDB_CLEAR +RPMDB_INIT +runroot rpm -i \ + --justdb --nodeps --ignorearch --ignoreos \ + /data/RPMS/foo-1.0-1.noarch.rpm \ + /data/RPMS/hello-2.0-1.i686.rpm +], +[0], +[], +[]) + +RPMPY_CHECK([ +ts = rpm.ts() +for h in ts.dbMatch('name'): + myprint(h['nevra']) +], +[foo-1.0-1.noarch +hello-2.0-1.i686 +], +[]) + +RPMPY_CHECK([ +ts = rpm.ts() +for h in ts.dbMatch('obsoletes'): + myprint(h['nevra']) +], +[foo-1.0-1.noarch +], +[]) + +RPMPY_CHECK([ +ts = rpm.ts() +for h in ts.dbMatch('provides', 'hi'): + myprint(h['nevra']) +], +[foo-1.0-1.noarch +], +[]) + +RPMPY_CHECK([ +ts = rpm.ts() +for h in ts.dbMatch('basenames', '/usr/share/doc/hello-2.0/FAQ'): + myprint(h['nevra']) +], +[hello-2.0-1.i686 +], +[]) +RPMPY_CHECK([ +ts = rpm.ts() +for di in ts.dbIndex('obsoletes'): + myprint(di) +], +[howdy +], +[]) + +RPMPY_CHECK([ +ts = rpm.ts() +for di in ts.dbIndex('provides'): + myprint(di) +], +[foo +hello +hello(x86-32) +hi +], +[]) +AT_CLEANUP