summaryrefslogtreecommitdiff
path: root/tests/test_cache_invocation.py
diff options
context:
space:
mode:
authorMichael Vogt <michael.vogt@ubuntu.com>2010-02-17 16:17:36 +0100
committerMichael Vogt <michael.vogt@ubuntu.com>2010-02-17 16:17:36 +0100
commitd1b2c0fbd34cee0ffced8270149b87def7675b2a (patch)
treef4b8a14fc619b2e6ea297385e289b2549f6f21a4 /tests/test_cache_invocation.py
parentc62bdd0b1b633b134ba551847da0c1e8d12115c2 (diff)
parent930f6a2899b0b410777397fb206a8eba8c99100c (diff)
downloadpython-apt-d1b2c0fbd34cee0ffced8270149b87def7675b2a.tar.gz
merged from the debian-sid branch
Diffstat (limited to 'tests/test_cache_invocation.py')
-rw-r--r--tests/test_cache_invocation.py30
1 files changed, 30 insertions, 0 deletions
diff --git a/tests/test_cache_invocation.py b/tests/test_cache_invocation.py
new file mode 100644
index 00000000..6f4014de
--- /dev/null
+++ b/tests/test_cache_invocation.py
@@ -0,0 +1,30 @@
+#!/usr/bin/python
+import unittest
+
+import apt_pkg
+import apt.progress.base
+
+
+class TestCache(unittest.TestCase):
+ """Test invocation of apt_pkg.Cache()"""
+
+ def setUp(self):
+ apt_pkg.init_config()
+ apt_pkg.init_system()
+
+ def test_wrong_invocation(self):
+ """cache_invocation: Test wrong invocation."""
+ apt_cache = apt_pkg.Cache(apt.progress.base.OpProgress())
+
+ self.assertRaises(ValueError, apt_pkg.Cache, apt_cache)
+ self.assertRaises(ValueError, apt_pkg.Cache,
+ apt.progress.base.AcquireProgress())
+ self.assertRaises(ValueError, apt_pkg.Cache, 0)
+
+ def test_proper_invocation(self):
+ """cache_invocation: Test correct invocation."""
+ apt_cache = apt_pkg.Cache(apt.progress.base.OpProgress())
+ apt_depcache = apt_pkg.DepCache(apt_cache)
+
+if __name__ == "__main__":
+ unittest.main()