From 5585c202437e0c6a18cef0fea79b03c09d9345f0 Mon Sep 17 00:00:00 2001 From: Michele D'Amico Date: Thu, 26 Oct 2023 19:33:01 +0200 Subject: [PATCH] Update metadata_extra.py check if datetime is empty string --- src/spid_sp_test/metadata_extra.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/spid_sp_test/metadata_extra.py b/src/spid_sp_test/metadata_extra.py index 13c6d12..c4d57ba 100644 --- a/src/spid_sp_test/metadata_extra.py +++ b/src/spid_sp_test/metadata_extra.py @@ -105,10 +105,12 @@ def test_Signature_extra(self): self._assertTrue( ( - datetime.datetime.strptime(sign_cert[3], "%b %d %H:%M:%S %Y") - >= datetime.datetime.now() + datetime.datetime != "" and ( + datetime.datetime.strptime(sign_cert[3], "%b %d %H:%M:%S %Y") + >= datetime.datetime.now() + ) ), - f"The certificate #{i} is expired. It was valid till {sign_cert[3]}", + f"The certificate #{i} is expired or datetime is not valid. It was valid till {sign_cert[3]}", **_data, ) os.remove(fname)