summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorMichał Górny <mgorny@gentoo.org>2017-10-26 22:44:33 +0200
committerMichał Górny <mgorny@gentoo.org>2017-10-26 22:44:33 +0200
commitea4d757852786ea334a034c30b4cd4cd34b76a21 (patch)
tree196078382605cc405d54403eefb5bae694c693dd /tests
parent32a985784b9d5a9abe6dd14cd43048d3da0753b5 (diff)
downloadgemato-ea4d757852786ea334a034c30b4cd4cd34b76a21.tar.gz
manifest: Test for incomplete OpenPGP message
Diffstat (limited to 'tests')
-rw-r--r--tests/test_openpgp.py18
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):
"""