summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorJulian Andres Klode <jak@debian.org>2011-04-11 10:13:15 +0200
committerJulian Andres Klode <jak@debian.org>2011-04-11 10:13:15 +0200
commitd5e763e1920eadf0bc0d460abbf686c65db2a3b4 (patch)
treef0f38674b4281ac5502366b4a41563d1407085ee /tests
parentfedfc6ec4584f43364e13e35326d051f5526700b (diff)
downloadpython-apt-d5e763e1920eadf0bc0d460abbf686c65db2a3b4.tar.gz
apt_pkg: Raise error when parse_commandline gets empty argv (LP: #707416)
Diffstat (limited to 'tests')
-rw-r--r--tests/test_configuration.py30
1 files changed, 30 insertions, 0 deletions
diff --git a/tests/test_configuration.py b/tests/test_configuration.py
new file mode 100644
index 00000000..80509cff
--- /dev/null
+++ b/tests/test_configuration.py
@@ -0,0 +1,30 @@
+#!/usr/bin/python
+#
+# Copyright (C) 2011 Julian Andres Klode <jak@debian.org>
+#
+# Copying and distribution of this file, with or without modification,
+# are permitted in any medium without royalty provided the copyright
+# notice and this notice are preserved.
+"""Unit tests for verifying the correctness of apt_pkg.Configuration"""
+import unittest
+
+import apt_pkg
+
+
+class TestConfiguration(unittest.TestCase):
+ """Test various configuration things"""
+
+ def setUp(self):
+ """Prepare the tests, create reference values..."""
+ apt_pkg.init_config()
+
+ def test_lp707416(self):
+ """configuration: Test empty arguments (LP: #707416)"""
+ self.assertRaises(ValueError, apt_pkg.parse_commandline,
+ apt_pkg.config,[], [])
+ self.assertRaises(SystemError, apt_pkg.parse_commandline,
+ apt_pkg.config,[], ["cmd", "--arg0"])
+
+
+if __name__ == "__main__":
+ unittest.main()