Skip to content

Commit c3a40b8

Browse files
author
Lukas Puehringer
committed
Add basic tests for gpg version functions
Since gpg version case handling was removed in a previous commit the related functions get_versions and is_version_fully_supported aren't used any more. This commit basic tests for these functions to maintain coverage. However, we might consider removing the two functions altogether.
1 parent 28ba993 commit c3a40b8

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

tests/test_gpg.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,20 +23,28 @@
2323
import shutil
2424
import tempfile
2525
import unittest
26+
from six import string_types
2627

2728
import cryptography.hazmat.primitives.serialization as serialization
2829
import cryptography.hazmat.backends as backends
2930

3031
from in_toto.gpg.functions import (gpg_sign_object, gpg_export_pubkey,
3132
gpg_verify_signature)
32-
from in_toto.gpg.util import is_version_fully_supported
33+
from in_toto.gpg.util import get_version, is_version_fully_supported
3334
from in_toto.gpg.rsa import create_pubkey as rsa_create_pubkey
3435
from in_toto.gpg.dsa import create_pubkey as dsa_create_pubkey
3536
from in_toto.gpg.common import parse_pubkey_payload
3637

3738
import securesystemslib.formats
3839
import securesystemslib.exceptions
3940

41+
class TestUtil(unittest.TestCase):
42+
"""Test util functions. """
43+
def test_version_utils_return_types(self):
44+
"""Run dummy tests for coverage. """
45+
self.assertTrue(isinstance(get_version(), string_types))
46+
self.assertTrue(isinstance(is_version_fully_supported(), bool))
47+
4048
class TestCommon(unittest.TestCase):
4149
"""Test common functions of the in_toto.gpg module. """
4250
def test_parse_empty_pubkey_payload(self):

0 commit comments

Comments
 (0)