From e8eff3ef97e30ec64fbb62e502ed24fe5baceca0 Mon Sep 17 00:00:00 2001 From: Dan McGee Date: Sun, 2 Dec 2007 17:56:48 -0600 Subject: Add more pactests to increase code coverage These new tests test the following ops at least once: -Ss, -Si, -Sl, -Sp, -Qs, -Qi, -T Signed-off-by: Dan McGee --- pactest/tests/deptest001.py | 20 ++++++++++++++++++++ pactest/tests/query001.py | 2 +- pactest/tests/query002.py | 10 ++++++++++ pactest/tests/query003.py | 10 ++++++++++ pactest/tests/query004.py | 10 ++++++++++ pactest/tests/sync1100.py | 11 +++++++++++ pactest/tests/sync1101.py | 11 +++++++++++ pactest/tests/sync1102.py | 12 ++++++++++++ pactest/tests/sync1103.py | 11 +++++++++++ 9 files changed, 96 insertions(+), 1 deletion(-) create mode 100644 pactest/tests/deptest001.py create mode 100644 pactest/tests/query002.py create mode 100644 pactest/tests/query003.py create mode 100644 pactest/tests/query004.py create mode 100644 pactest/tests/sync1100.py create mode 100644 pactest/tests/sync1101.py create mode 100644 pactest/tests/sync1102.py create mode 100644 pactest/tests/sync1103.py (limited to 'pactest/tests') diff --git a/pactest/tests/deptest001.py b/pactest/tests/deptest001.py new file mode 100644 index 00000000..db0b7684 --- /dev/null +++ b/pactest/tests/deptest001.py @@ -0,0 +1,20 @@ +self.description = "test deptest (-T) functionality" + +sp1 = pmpkg("pkg1") +sp1.depends = ["dep"] +self.addpkg2db("sync", sp1) + +sp1dep = pmpkg("dep") +self.addpkg2db("sync", sp1dep) + +sp2 = pmpkg("pkg2") +self.addpkg2db("sync", sp2) + +lp2 = pmpkg("pkg2") +self.addpkg2db("local", lp2) + +self.args = "-T pkg1 pkg2" + +self.addrule("PACMAN_RETCODE=127") +self.addrule("PACMAN_OUTPUT=pkg1") +self.addrule("!PACMAN_OUTPUT=pkg2") diff --git a/pactest/tests/query001.py b/pactest/tests/query001.py index 315af84a..8faf0e15 100644 --- a/pactest/tests/query001.py +++ b/pactest/tests/query001.py @@ -7,4 +7,4 @@ self.addpkg2db("local", p) self.args = "-Q %s" % p.name self.addrule("PACMAN_RETCODE=0") -self.addrule("PACMAN_OUTPUT=foobar") +self.addrule("PACMAN_OUTPUT=%s" % p.name) diff --git a/pactest/tests/query002.py b/pactest/tests/query002.py new file mode 100644 index 00000000..830936b4 --- /dev/null +++ b/pactest/tests/query002.py @@ -0,0 +1,10 @@ +self.description = "Query info on a package" + +p = pmpkg("foobar") +p.files = ["bin/foobar"] +self.addpkg2db("local", p) + +self.args = "-Qi %s" % p.name + +self.addrule("PACMAN_RETCODE=0") +self.addrule("PACMAN_OUTPUT=%s" % p.name) diff --git a/pactest/tests/query003.py b/pactest/tests/query003.py new file mode 100644 index 00000000..ea113081 --- /dev/null +++ b/pactest/tests/query003.py @@ -0,0 +1,10 @@ +self.description = "Query search for a package" + +p = pmpkg("foobar") +p.files = ["bin/foobar"] +self.addpkg2db("local", p) + +self.args = "-Qs %s" % p.name + +self.addrule("PACMAN_RETCODE=0") +self.addrule("PACMAN_OUTPUT=%s" % p.name) diff --git a/pactest/tests/query004.py b/pactest/tests/query004.py new file mode 100644 index 00000000..8faf0e15 --- /dev/null +++ b/pactest/tests/query004.py @@ -0,0 +1,10 @@ +self.description = "Query a package" + +p = pmpkg("foobar") +p.files = ["bin/foobar"] +self.addpkg2db("local", p) + +self.args = "-Q %s" % p.name + +self.addrule("PACMAN_RETCODE=0") +self.addrule("PACMAN_OUTPUT=%s" % p.name) diff --git a/pactest/tests/sync1100.py b/pactest/tests/sync1100.py new file mode 100644 index 00000000..1f8fa057 --- /dev/null +++ b/pactest/tests/sync1100.py @@ -0,0 +1,11 @@ +self.description = "Get info on package from a sync db" + +sp = pmpkg("dummy") +sp.files = ["bin/dummy", + "usr/man/man1/dummy.1"] +self.addpkg2db("sync", sp) + +self.args = "-Si %s" % sp.name + +self.addrule("PACMAN_RETCODE=0") +self.addrule("PACMAN_OUTPUT=%s" % sp.name) diff --git a/pactest/tests/sync1101.py b/pactest/tests/sync1101.py new file mode 100644 index 00000000..ba2ad44f --- /dev/null +++ b/pactest/tests/sync1101.py @@ -0,0 +1,11 @@ +self.description = "Search for package from a sync db" + +sp = pmpkg("dummy") +sp.files = ["bin/dummy", + "usr/man/man1/dummy.1"] +self.addpkg2db("sync", sp) + +self.args = "-Ss %s" % sp.name + +self.addrule("PACMAN_RETCODE=0") +self.addrule("PACMAN_OUTPUT=%s" % sp.name) diff --git a/pactest/tests/sync1102.py b/pactest/tests/sync1102.py new file mode 100644 index 00000000..3a27238f --- /dev/null +++ b/pactest/tests/sync1102.py @@ -0,0 +1,12 @@ +self.description = "Get URL on package from a sync db" + +sp = pmpkg("dummy") +sp.files = ["bin/dummy", + "usr/man/man1/dummy.1"] +self.addpkg2db("sync", sp) + +self.args = "-Sp %s" % sp.name + +self.addrule("PACMAN_RETCODE=0") +self.addrule("PACMAN_OUTPUT=%s" % sp.name) +self.addrule("PACMAN_OUTPUT=file://") diff --git a/pactest/tests/sync1103.py b/pactest/tests/sync1103.py new file mode 100644 index 00000000..052c7236 --- /dev/null +++ b/pactest/tests/sync1103.py @@ -0,0 +1,11 @@ +self.description = "Get package list from sync dbs" + +sp = pmpkg("dummy") +sp.files = ["bin/dummy", + "usr/man/man1/dummy.1"] +self.addpkg2db("sync", sp) + +self.args = "-Sl" + +self.addrule("PACMAN_RETCODE=0") +self.addrule("PACMAN_OUTPUT=%s" % sp.name) -- cgit v1.2.3-70-g09d2