All of lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] [PATCH] support/testing: add python-asn1crypto runtime test
@ 2024-02-12 12:56 Marcus Hoffmann via buildroot
  2024-07-15 11:41 ` Thomas Petazzoni via buildroot
  2024-08-27 18:05 ` Peter Korsgaard
  0 siblings, 2 replies; 4+ messages in thread
From: Marcus Hoffmann via buildroot @ 2024-02-12 12:56 UTC (permalink / raw)
  To: buildroot

Signed-off-by: Marcus Hoffmann <buildroot@bubu1.eu>
---
 .../tests/package/sample_python_asn1crypto.py       | 11 +++++++++++
 .../testing/tests/package/test_python_asn1crypto.py | 13 +++++++++++++
 2 files changed, 24 insertions(+)
 create mode 100644 support/testing/tests/package/sample_python_asn1crypto.py
 create mode 100644 support/testing/tests/package/test_python_asn1crypto.py

diff --git a/support/testing/tests/package/sample_python_asn1crypto.py b/support/testing/tests/package/sample_python_asn1crypto.py
new file mode 100644
index 0000000000..0b10487572
--- /dev/null
+++ b/support/testing/tests/package/sample_python_asn1crypto.py
@@ -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"
diff --git a/support/testing/tests/package/test_python_asn1crypto.py b/support/testing/tests/package/test_python_asn1crypto.py
new file mode 100644
index 0000000000..97df3d3ac8
--- /dev/null
+++ b/support/testing/tests/package/test_python_asn1crypto.py
@@ -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
-- 
2.34.1

_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply related	[flat|nested] 4+ messages in thread
* [Buildroot] [PATCH] support/testing: add python-asn1crypto runtime test
@ 2024-02-12 12:47 Marcus Hoffmann via buildroot
  0 siblings, 0 replies; 4+ messages in thread
From: Marcus Hoffmann via buildroot @ 2024-02-12 12:47 UTC (permalink / raw)
  To: buildroot

---
 .../tests/package/sample_python_asn1crypto.py       | 11 +++++++++++
 .../testing/tests/package/test_python_asn1crypto.py | 13 +++++++++++++
 2 files changed, 24 insertions(+)
 create mode 100644 support/testing/tests/package/sample_python_asn1crypto.py
 create mode 100644 support/testing/tests/package/test_python_asn1crypto.py

diff --git a/support/testing/tests/package/sample_python_asn1crypto.py b/support/testing/tests/package/sample_python_asn1crypto.py
new file mode 100644
index 0000000000..0b10487572
--- /dev/null
+++ b/support/testing/tests/package/sample_python_asn1crypto.py
@@ -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"
diff --git a/support/testing/tests/package/test_python_asn1crypto.py b/support/testing/tests/package/test_python_asn1crypto.py
new file mode 100644
index 0000000000..97df3d3ac8
--- /dev/null
+++ b/support/testing/tests/package/test_python_asn1crypto.py
@@ -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
-- 
2.34.1

_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2024-08-27 18:05 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-02-12 12:56 [Buildroot] [PATCH] support/testing: add python-asn1crypto runtime test Marcus Hoffmann via buildroot
2024-07-15 11:41 ` Thomas Petazzoni via buildroot
2024-08-27 18:05 ` Peter Korsgaard
  -- strict thread matches above, loose matches on Subject: below --
2024-02-12 12:47 Marcus Hoffmann via buildroot

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.