7e1b55
From 826b5825bd644fc69a9bee17626d71fe03cc0190 Mon Sep 17 00:00:00 2001
7e1b55
From: Rob Crittenden <rcritten@redhat.com>
7e1b55
Date: Mon, 26 Jul 2021 16:14:19 -0400
7e1b55
Subject: [PATCH] ipatests: verify that getcert output includes the issued date
7e1b55
7e1b55
certmonger 0.79.14 included a new feature that provides the
7e1b55
NotBefore (or issued) date to the certificate list output.
7e1b55
7e1b55
Verify that it is present in the output.
7e1b55
7e1b55
https://bugzilla.redhat.com/show_bug.cgi?id=1940261
7e1b55
7e1b55
Signed-off-by: Rob Crittenden <rcritten@redhat.com>
7e1b55
Reviewed-By: Mohammad Rizwan <myusuf@redhat.com>
7e1b55
Reviewed-By: Florence Blanc-Renaud <frenaud@redhat.com>
7e1b55
---
7e1b55
 ipatests/test_integration/test_cert.py | 11 +++++++++++
7e1b55
 1 file changed, 11 insertions(+)
7e1b55
7e1b55
diff --git a/ipatests/test_integration/test_cert.py b/ipatests/test_integration/test_cert.py
7e1b55
index b6bb2f08a..9a90db5e2 100644
7e1b55
--- a/ipatests/test_integration/test_cert.py
7e1b55
+++ b/ipatests/test_integration/test_cert.py
7e1b55
@@ -19,6 +19,7 @@ from ipaplatform.paths import paths
7e1b55
 from cryptography import x509
7e1b55
 from cryptography.x509.oid import ExtensionOID
7e1b55
 from cryptography.hazmat.backends import default_backend
7e1b55
+from pkg_resources import parse_version
7e1b55
 
7e1b55
 from ipatests.pytest_ipa.integration import tasks
7e1b55
 from ipatests.test_integration.base import IntegrationTest
7e1b55
@@ -257,6 +258,16 @@ class TestInstallMasterClient(IntegrationTest):
7e1b55
             raise AssertionError("certmonger request is "
7e1b55
                                  "in state {}". format(status))
7e1b55
 
7e1b55
+    def test_getcert_notafter_output(self):
7e1b55
+        """Test that currrent certmonger includes NotBefore in output"""
7e1b55
+        result = self.master.run_command(["certmonger", "-v"]).stdout_text
7e1b55
+        if parse_version(result.split()[1]) < parse_version('0.79.14'):
7e1b55
+            raise pytest.skip("not_before not provided in this version")
7e1b55
+        result = self.master.run_command(
7e1b55
+            ["getcert", "list", "-f", paths.HTTPD_CERT_FILE]
7e1b55
+        ).stdout_text
7e1b55
+        assert 'issued:' in result
7e1b55
+
7e1b55
 
7e1b55
 class TestCertmongerRekey(IntegrationTest):
7e1b55
 
7e1b55
-- 
7e1b55
2.31.1
7e1b55