mirror of
https://github.com/clearlinux/autospec.git
synced 2026-08-24 00:15:49 +00:00
Adding more tests to verify_sign
Added one testcase for GEM validation and one test to cover condition when package does not have a matching signature.
This commit is contained in:
+18
-1
@@ -12,8 +12,18 @@ from verify_sign import (get_verifier,
|
||||
|
||||
ALEMBIC_PKT_URL = "http://pypi.debian.net/alembic/alembic-0.8.8.tar.gz"
|
||||
XATTR_PKT_URL = "http://pypi.debian.net/xattr/xattr-0.9.1.tar.gz"
|
||||
NO_SIGN_PKT_URL = "https://pypi.python.org/packages/source/c/crudini/crudini-0.5.tgz"
|
||||
GEM_PKT = "https://rubygems.org/downloads/hoe-debugging-1.2.1.gem"
|
||||
|
||||
# TODO add TestGEMVerifier
|
||||
|
||||
class testGEMShaVerifier(unittest.TestCase):
|
||||
|
||||
def test_from_url(self):
|
||||
with tempfile.TemporaryDirectory() as tmpd:
|
||||
out_file = os.path.join(tmpd, os.path.basename(GEM_PKT))
|
||||
attempt_to_download(GEM_PKT, out_file)
|
||||
result = from_url(GEM_PKT, tmpd)
|
||||
self.assertTrue(result)
|
||||
|
||||
|
||||
class TestGPGVerifier(unittest.TestCase):
|
||||
@@ -42,6 +52,13 @@ class TestGPGVerifier(unittest.TestCase):
|
||||
result = from_disk('NonExistentPKG.tar.gz', 'NonExistentKey.asc')
|
||||
self.assertTrue(result is None)
|
||||
|
||||
def test_result_on_nosign_package(self):
|
||||
with tempfile.TemporaryDirectory() as tmpd:
|
||||
out_file = os.path.join(tmpd, os.path.basename(NO_SIGN_PKT_URL))
|
||||
attempt_to_download(NO_SIGN_PKT_URL, out_file)
|
||||
result = from_url(NO_SIGN_PKT_URL, tmpd)
|
||||
self.assertTrue(result is None)
|
||||
|
||||
|
||||
class TestUtils(unittest.TestCase):
|
||||
|
||||
|
||||
Reference in New Issue
Block a user