diff options
author | Michał Górny <mgorny@gentoo.org> | 2017-10-27 15:41:58 +0200 |
---|---|---|
committer | Michał Górny <mgorny@gentoo.org> | 2017-10-27 15:43:05 +0200 |
commit | 02d632e75a20c5c2540d4dc703289581f60047f4 (patch) | |
tree | 884408687ac6520d3986e351a6c1b34694a93495 /tests/test_openpgp.py | |
parent | a858b23414005c13f208cbfcaa070784f923ea61 (diff) | |
download | gemato-02d632e75a20c5c2540d4dc703289581f60047f4.tar.gz |
Add tests for CLI routines
Diffstat (limited to 'tests/test_openpgp.py')
-rw-r--r-- | tests/test_openpgp.py | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/tests/test_openpgp.py b/tests/test_openpgp.py index 17a43ae..c3f61d2 100644 --- a/tests/test_openpgp.py +++ b/tests/test_openpgp.py @@ -9,6 +9,7 @@ import shutil import tempfile import unittest +import gemato.cli import gemato.compression import gemato.manifest import gemato.openpgp @@ -210,6 +211,27 @@ class SignedManifestTest(unittest.TestCase): finally: shutil.rmtree(d) + def test_cli(self): + d = tempfile.mkdtemp() + try: + with io.open(os.path.join(d, 'Manifest'), 'w') as f: + f.write(MODIFIED_SIGNED_MANIFEST) + + os.mkdir(os.path.join(d, 'eclass')) + with io.open(os.path.join(d, 'eclass/Manifest'), 'w'): + pass + with io.open(os.path.join(d, 'myebuild-0.ebuild'), 'wb') as f: + f.write(b'12345678901234567890123456789012') + with io.open(os.path.join(d, 'metadata.xml'), 'w'): + pass + + self.assertEqual( + gemato.cli.main(['gemato', 'verify', + '--no-openpgp-verify', d]), + 0) + finally: + shutil.rmtree(d) + class OpenPGPCorrectKeyTest(unittest.TestCase): """ @@ -293,6 +315,27 @@ class OpenPGPCorrectKeyTest(unittest.TestCase): finally: shutil.rmtree(d) + def test_cli(self): + d = tempfile.mkdtemp() + try: + with io.open(os.path.join(d, 'Manifest'), 'w') as f: + f.write(SIGNED_MANIFEST) + + os.mkdir(os.path.join(d, 'eclass')) + with io.open(os.path.join(d, 'eclass/Manifest'), 'w'): + pass + with io.open(os.path.join(d, 'myebuild-0.ebuild'), 'w'): + pass + with io.open(os.path.join(d, 'metadata.xml'), 'w'): + pass + + self.assertEqual( + gemato.cli.main(['gemato', 'verify', + '--require-signed-manifest', d]), + 0) + finally: + shutil.rmtree(d) + class OpenPGPNoKeyTest(unittest.TestCase): """ |