diff options
author | Michał Górny <mgorny@gentoo.org> | 2017-10-26 22:44:33 +0200 |
---|---|---|
committer | Michał Górny <mgorny@gentoo.org> | 2017-10-26 22:44:33 +0200 |
commit | ea4d757852786ea334a034c30b4cd4cd34b76a21 (patch) | |
tree | 196078382605cc405d54403eefb5bae694c693dd /tests/test_openpgp.py | |
parent | 32a985784b9d5a9abe6dd14cd43048d3da0753b5 (diff) | |
download | gemato-ea4d757852786ea334a034c30b4cd4cd34b76a21.tar.gz |
manifest: Test for incomplete OpenPGP message
Diffstat (limited to 'tests/test_openpgp.py')
-rw-r--r-- | tests/test_openpgp.py | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/tests/test_openpgp.py b/tests/test_openpgp.py index 3771bed..32028f0 100644 --- a/tests/test_openpgp.py +++ b/tests/test_openpgp.py @@ -171,6 +171,24 @@ class SignedManifestTest(unittest.TestCase): self.assertRaises(gemato.exceptions.ManifestUnsignedData, m.load, f) + def test_signed_manifest_terminated_before_data(self): + m = gemato.manifest.ManifestFile() + with io.StringIO('\n'.join(SIGNED_MANIFEST.splitlines()[:3])) as f: + self.assertRaises(gemato.exceptions.ManifestSyntaxError, + m.load, f) + + def test_signed_manifest_terminated_before_signature(self): + m = gemato.manifest.ManifestFile() + with io.StringIO('\n'.join(SIGNED_MANIFEST.splitlines()[:7])) as f: + self.assertRaises(gemato.exceptions.ManifestSyntaxError, + m.load, f) + + def test_signed_manifest_terminated_before_end(self): + m = gemato.manifest.ManifestFile() + with io.StringIO('\n'.join(SIGNED_MANIFEST.splitlines()[:15])) as f: + self.assertRaises(gemato.exceptions.ManifestSyntaxError, + m.load, f) + class OpenPGPCorrectKeyTest(unittest.TestCase): """ |