diff options
| author | Michael Vogt <mvo@ubuntu.com> | 2014-11-06 21:59:18 +0100 |
|---|---|---|
| committer | Michael Vogt <mvo@ubuntu.com> | 2014-11-06 21:59:18 +0100 |
| commit | d92026e96db4a4d03cec9f135b5407804892c55f (patch) | |
| tree | da845b12789b2e0e51f23723020ecf02080a7bb4 /tests | |
| parent | b066cf677e2cbd480bd2e74b48147bfd226ae463 (diff) | |
| download | python-apt-d92026e96db4a4d03cec9f135b5407804892c55f.tar.gz | |
Add binding for apt_pkg.maybe_open_clear_signed_file()
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/test_tagfile.py | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/tests/test_tagfile.py b/tests/test_tagfile.py index 6ff6a32a..986ddfbc 100644 --- a/tests/test_tagfile.py +++ b/tests/test_tagfile.py @@ -28,6 +28,29 @@ if libdir: import apt_pkg +class TestOpenMaybeClearSigned(unittest.TestCase): + + def test_open_trivial(self): + basepath = os.path.dirname(__file__) + fd = apt_pkg.open_maybe_clear_signed_file( + os.path.join(basepath, "./data/test_debs/hello_2.5-1.dsc")) + f = os.fdopen(fd) + data = f.read().encode("utf-8") + self.assertTrue(data.startswith("Format: 1.0\n")) + + def test_open_normal(self): + basepath = os.path.dirname(__file__) + fd = apt_pkg.open_maybe_clear_signed_file( + os.path.join(basepath, "./data/misc/foo_Release")) + f = os.fdopen(fd) + data = f.read().encode("utf-8") + self.assertTrue(data.startswith("Origin: Ubuntu\n")) + + def xtest_open_does_not_exit(self): + with self.assertRaises(SystemError): + apt_pkg.open_maybe_clear_signed_file("does-not-exists") + + class TestTagFile(unittest.TestCase): """ test the apt_pkg.TagFile """ |
