aboutsummaryrefslogtreecommitdiffstats
path: root/tests/oom-platform-cert-service/postprocessor/libraries/PemTruststoreValidator.py
diff options
context:
space:
mode:
authorKrzysztof Kuzmicki <krzysztof.kuzmicki@nokia.com>2020-09-23 08:10:30 +0000
committerGerrit Code Review <gerrit@onap.org>2020-09-23 08:10:30 +0000
commitae2557a38de9d241bd331de8fa6095b956698927 (patch)
treef259c831d8b0dd62989e667a9574ddde5c1eaf66 /tests/oom-platform-cert-service/postprocessor/libraries/PemTruststoreValidator.py
parent63b81b47402308e77b26bafbfd32e7f6c6f62320 (diff)
parente0da464c1b8bfe7ceb1f16879a2c550e7348fe18 (diff)
Merge "[OOM-CMPv2] Rename truststoremerger->postprocessor"
Diffstat (limited to 'tests/oom-platform-cert-service/postprocessor/libraries/PemTruststoreValidator.py')
-rw-r--r--tests/oom-platform-cert-service/postprocessor/libraries/PemTruststoreValidator.py19
1 files changed, 19 insertions, 0 deletions
diff --git a/tests/oom-platform-cert-service/postprocessor/libraries/PemTruststoreValidator.py b/tests/oom-platform-cert-service/postprocessor/libraries/PemTruststoreValidator.py
new file mode 100644
index 00000000..8dc9623d
--- /dev/null
+++ b/tests/oom-platform-cert-service/postprocessor/libraries/PemTruststoreValidator.py
@@ -0,0 +1,19 @@
+import re
+
+BEGIN_CERT = "-----BEGIN CERTIFICATE-----"
+END_CERT = "-----END CERTIFICATE-----"
+
+class PemTruststoreValidator:
+
+ def assert_pem_truststores_equal(self, result_pem_path, expected_pem_path):
+ result_certs = self.get_list_of_pem_certificates(result_pem_path)
+ expected_certs = self.get_list_of_pem_certificates(expected_pem_path)
+ result_certs.sort()
+ expected_certs.sort()
+ if len(result_certs) != len(expected_certs):
+ return False
+ return result_certs == expected_certs
+
+
+ def get_list_of_pem_certificates(self, path):
+ return re.findall(BEGIN_CERT + '(.+?)' + END_CERT, open(path, 'rb').read(), re.DOTALL)