Skip to content

Commit

Permalink
support/testing: add python-asn1crypto runtime test
Browse files Browse the repository at this point in the history
Signed-off-by: Marcus Hoffmann <[email protected]>
Signed-off-by: Thomas Petazzoni <[email protected]>
  • Loading branch information
Marcus Hoffmann authored and tpetazzoni committed Jul 15, 2024
1 parent c306853 commit 2fe638a
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 0 deletions.
2 changes: 2 additions & 0 deletions DEVELOPERS
Original file line number Diff line number Diff line change
Expand Up @@ -2180,6 +2180,8 @@ F: package/libselinux/
F: package/libsemanage/
F: package/libsepol/
F: package/selinux-python/
F: support/testing/tests/package/sample_python_asn1crypto.py
F: support/testing/tests/package/test_python_asn1crypto.py
F: utils/config
F: utils/diffconfig

Expand Down
11 changes: 11 additions & 0 deletions support/testing/tests/package/sample_python_asn1crypto.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
from asn1crypto import pem, x509


with open('/etc/ssl/certs/ISRG_Root_X2.pem', 'rb') as f:
der_bytes = f.read()
if pem.detect(der_bytes):
type_name, headers, der_bytes = pem.unarmor(der_bytes)

cert = x509.Certificate.load(der_bytes)

assert cert.subject.native["common_name"] == "ISRG Root X2"
13 changes: 13 additions & 0 deletions support/testing/tests/package/test_python_asn1crypto.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
from tests.package.test_python import TestPythonPackageBase


class TestPythonPy3Asn1Crypto(TestPythonPackageBase):
__test__ = True
config = TestPythonPackageBase.config + \
"""
BR2_PACKAGE_CA_CERTIFICATES=y
BR2_PACKAGE_PYTHON3=y
BR2_PACKAGE_PYTHON_ASN1CRYPTO=y
"""
sample_scripts = ["tests/package/sample_python_asn1crypto.py"]
timeout = 40

0 comments on commit 2fe638a

Please sign in to comment.