From 3050e47fb95f4cd4628ccca5326e69e0b1c401dd Mon Sep 17 00:00:00 2001 From: Michał Górny Date: Wed, 25 Oct 2017 14:06:31 +0200 Subject: openpgp: Improve closed manager handling --- tests/test_openpgp.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'tests') diff --git a/tests/test_openpgp.py b/tests/test_openpgp.py index 88b105b..11a6f6e 100644 --- a/tests/test_openpgp.py +++ b/tests/test_openpgp.py @@ -222,3 +222,15 @@ class OpenPGPContextManagerTest(unittest.TestCase): env.verify_file(f) except gemato.exceptions.OpenPGPNoImplementation as e: raise unittest.SkipTest(str(e)) + + def test_double_close(self): + with io.BytesIO(SIGNED_MANIFEST.encode('utf8')) as f: + with gemato.openpgp.OpenPGPEnvironment() as env: + env.close() + + def test_home_after_close(self): + with io.BytesIO(SIGNED_MANIFEST.encode('utf8')) as f: + with gemato.openpgp.OpenPGPEnvironment() as env: + env.close() + with self.assertRaises(RuntimeError): + env.home -- cgit v1.2.3