summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/data/test_debs/gdebi-test11.debbin0 -> 634 bytes
-rw-r--r--tests/data/test_debs/gdebi-test12.debbin0 -> 966 bytes
-rw-r--r--tests/test_apt_cache.py3
-rw-r--r--tests/test_debfile.py13
4 files changed, 16 insertions, 0 deletions
diff --git a/tests/data/test_debs/gdebi-test11.deb b/tests/data/test_debs/gdebi-test11.deb
new file mode 100644
index 00000000..af9b441f
--- /dev/null
+++ b/tests/data/test_debs/gdebi-test11.deb
Binary files differ
diff --git a/tests/data/test_debs/gdebi-test12.deb b/tests/data/test_debs/gdebi-test12.deb
new file mode 100644
index 00000000..36544cc7
--- /dev/null
+++ b/tests/data/test_debs/gdebi-test12.deb
Binary files differ
diff --git a/tests/test_apt_cache.py b/tests/test_apt_cache.py
index 81d64bc6..44b95cab 100644
--- a/tests/test_apt_cache.py
+++ b/tests/test_apt_cache.py
@@ -1,6 +1,7 @@
#!/usr/bin/python
#
# Copyright (C) 2010 Julian Andres Klode <jak@debian.org>
+# 2010 Michael Vogt <mvo@ubuntu.com>
#
# Copying and distribution of this file, with or without modification,
# are permitted in any medium without royalty provided the copyright
@@ -51,6 +52,7 @@ class TestAptCache(unittest.TestCase):
# a true virtual pkg
l = cache.get_providing_packages("mail-transport-agent")
self.assertTrue(len(l) > 0)
+ self.assertTrue("postfix" in [p.name for p in l])
# this is a not virtual (transitional) package provided by another
l = cache.get_providing_packages("scrollkeeper")
self.assertEqual(l, [])
@@ -59,6 +61,7 @@ class TestAptCache(unittest.TestCase):
l = cache.get_providing_packages("scrollkeeper",
include_nonvirtual=True)
self.assertTrue(len(l), 1)
+ self.assertTrue("mail-transport-agent" in cache["postfix"].candidate.provides)
def test_dpkg_journal_dirty(self):
diff --git a/tests/test_debfile.py b/tests/test_debfile.py
index 5874dfc4..42cda6f6 100644
--- a/tests/test_debfile.py
+++ b/tests/test_debfile.py
@@ -77,6 +77,19 @@ class TestDebfilee(unittest.TestCase):
"Unexpected result for package '%s' (got %s wanted %s)\n%s" % (
filename, res, expected_res, deb._failure_string))
+ def testContent(self):
+ # normal
+ deb = apt.debfile.DebPackage(cache=self.cache)
+ deb.open(os.path.join("data", "test_debs", "gdebi-test11.deb"))
+ self.assertEqual('#!/bin/sh\necho "test"\n',
+ deb.data_content("usr/bin/test"))
+ # binary
+ deb = apt.debfile.DebPackage(cache=self.cache)
+ deb.open(os.path.join("data", "test_debs", "gdebi-test12.deb"))
+ content = deb.data_content("usr/bin/binary")
+ self.assertTrue(content.startswith("Automatically converted to printable ascii:\n\x7fELF "))
+
+
if __name__ == "__main__":
#logging.basicConfig(level=logging.DEBUG)
unittest.main()