caless tests: make debug log of certificates sensible

CA-less tests debug logging uses representation of a variable
containing the certificate object, which does not help very much.
Use the actual DER representation of the certificate on such places.

Reviewed-By: Michal Reznik <mreznik@redhat.com>
Reviewed-By: Rob Crittenden <rcritten@redhat.com>
This commit is contained in:
Stanislav Laznicka 2017-11-06 09:07:31 +01:00
parent 5458bb506f
commit a3009b392a
No known key found for this signature in database
GPG Key ID: C98C414936B1A7F3

View File

@ -360,8 +360,8 @@ class CALessBase(IntegrationTest):
logger.debug('Expected /etc/ipa/ca.crt contents:\n%s',
expected_cacrt.decode('utf-8'))
expected_cacrt = x509.load_unknown_x509_certificate(expected_cacrt)
logger.debug('Expected binary CA cert:\n%r',
expected_cacrt)
logger.debug('Expected CA cert:\n%r',
expected_cacrt.public_bytes(x509.Encoding.PEM))
for host in [self.master] + self.replicas:
# Check the LDAP entry
ldap = host.ldap_connect()
@ -370,7 +370,7 @@ class CALessBase(IntegrationTest):
('cn', 'etc'), host.domain.basedn))
cert_from_ldap = entry.single_value['cACertificate']
logger.debug('CA cert from LDAP on %s:\n%r',
host, cert_from_ldap)
host, cert_from_ldap.public_bytes(x509.Encoding.PEM))
assert cert_from_ldap == expected_cacrt
# Verify certmonger was not started
@ -384,7 +384,7 @@ class CALessBase(IntegrationTest):
host, remote_cacrt)
cacrt = x509.load_unknown_x509_certificate(remote_cacrt)
logger.debug('%s: Decoded /etc/ipa/ca.crt:\n%r',
host, cacrt)
host, cacrt.public_bytes(x509.Encoding.PEM))
assert expected_cacrt == cacrt