diff options
author | 2020-09-22 08:04:23 +0200 | |
---|---|---|
committer | 2020-09-22 20:01:03 +0200 | |
commit | e0da464c1b8bfe7ceb1f16879a2c550e7348fe18 (patch) | |
tree | dbf127607c7e8708776514ab3fbfc67196e7add6 /tests/oom-platform-cert-service/postprocessor/libraries/PemTruststoreValidator.py | |
parent | 97c946e21835cbc213f9974ed0df05ef702f4b88 (diff) |
[OOM-CMPv2] Rename truststoremerger->postprocessor
Issue-ID: DCAEGEN2-2253
Signed-off-by: Jan Malkiewicz <jan.malkiewicz@nokia.com>
Change-Id: I6c7fa3378c86dee4e1fe23e4840046b979d942ea
Diffstat (limited to 'tests/oom-platform-cert-service/postprocessor/libraries/PemTruststoreValidator.py')
-rw-r--r-- | tests/oom-platform-cert-service/postprocessor/libraries/PemTruststoreValidator.py | 19 |
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) |