diff options
Diffstat (limited to 'tests/test_openpgp.py')
-rw-r--r-- | tests/test_openpgp.py | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/tests/test_openpgp.py b/tests/test_openpgp.py index dc2eafc..88b105b 100644 --- a/tests/test_openpgp.py +++ b/tests/test_openpgp.py @@ -202,3 +202,23 @@ class OpenPGPNoKeyTest(unittest.TestCase): self.env.verify_file, f) except gemato.exceptions.OpenPGPNoImplementation as e: raise unittest.SkipTest(str(e)) + + +class OpenPGPContextManagerTest(unittest.TestCase): + """ + Test the context manager API for OpenPGPEnvironment. + """ + + def test_verify_manifest(self): + with io.BytesIO(SIGNED_MANIFEST.encode('utf8')) as f: + with gemato.openpgp.OpenPGPEnvironment() as env: + try: + try: + env.import_key( + io.BytesIO(PUBLIC_KEY.encode('utf8'))) + except RuntimeError: + raise unittest.SkipTest('Unable to import OpenPGP key') + + env.verify_file(f) + except gemato.exceptions.OpenPGPNoImplementation as e: + raise unittest.SkipTest(str(e)) |