Blob Blame History Raw
From 826b5825bd644fc69a9bee17626d71fe03cc0190 Mon Sep 17 00:00:00 2001
From: Rob Crittenden <rcritten@redhat.com>
Date: Mon, 26 Jul 2021 16:14:19 -0400
Subject: [PATCH] ipatests: verify that getcert output includes the issued date

certmonger 0.79.14 included a new feature that provides the
NotBefore (or issued) date to the certificate list output.

Verify that it is present in the output.

https://bugzilla.redhat.com/show_bug.cgi?id=1940261

Signed-off-by: Rob Crittenden <rcritten@redhat.com>
Reviewed-By: Mohammad Rizwan <myusuf@redhat.com>
Reviewed-By: Florence Blanc-Renaud <frenaud@redhat.com>
---
 ipatests/test_integration/test_cert.py | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/ipatests/test_integration/test_cert.py b/ipatests/test_integration/test_cert.py
index b6bb2f08a..9a90db5e2 100644
--- a/ipatests/test_integration/test_cert.py
+++ b/ipatests/test_integration/test_cert.py
@@ -19,6 +19,7 @@ from ipaplatform.paths import paths
 from cryptography import x509
 from cryptography.x509.oid import ExtensionOID
 from cryptography.hazmat.backends import default_backend
+from pkg_resources import parse_version
 
 from ipatests.pytest_ipa.integration import tasks
 from ipatests.test_integration.base import IntegrationTest
@@ -257,6 +258,16 @@ class TestInstallMasterClient(IntegrationTest):
             raise AssertionError("certmonger request is "
                                  "in state {}". format(status))
 
+    def test_getcert_notafter_output(self):
+        """Test that currrent certmonger includes NotBefore in output"""
+        result = self.master.run_command(["certmonger", "-v"]).stdout_text
+        if parse_version(result.split()[1]) < parse_version('0.79.14'):
+            raise pytest.skip("not_before not provided in this version")
+        result = self.master.run_command(
+            ["getcert", "list", "-f", paths.HTTPD_CERT_FILE]
+        ).stdout_text
+        assert 'issued:' in result
+
 
 class TestCertmongerRekey(IntegrationTest):
 
-- 
2.31.1