def test_satellite_ca_chain(): certs = ssl_certificate.SatelliteCustomCaChain(context_wrap(SATELLITE_OUTPUT1)) assert len(certs) == 3 assert certs.earliest_expiry_date.str == 'Jan 18 07:02:43 2018' assert certs[0]['subject'] == '/C=US/ST=North Carolina/L=Raleigh/O=Katello/OU=SomeOrgUnit/CN=test.a.com' assert certs[0]['notAfter'].str == 'Jan 18 07:02:33 2038' assert certs[1]['subject'] == '/C=US/ST=North Carolina/O=Katello/OU=SomeOrgUnit/CN=test.b.com' assert certs[1]['notAfter'].str == 'Jan 18 07:02:43 2018' assert certs[2]['subject'] == '/C=US/ST=North Carolina/O=Katello/OU=SomeOrgUnit/CN=test.c.com' assert certs[2]['notAfter'].str == 'Jan 18 07:02:43 2048'
def test_doc(): cert = ssl_certificate.CertificateInfo(context_wrap(CERTIFICATE_OUTPUT1)) ca_cert = ssl_certificate.CertificateChain( context_wrap(CERTIFICATE_CHAIN_OUTPUT1)) satellite_ca_certs = ssl_certificate.SatelliteCustomCaChain( context_wrap(SATELLITE_OUTPUT2)) rhsm_katello_default_ca = ssl_certificate.RhsmKatelloDefaultCACert( context_wrap(RHSM_KATELLO_CERT_OUTPUT1)) globs = { 'cert': cert, 'certs': ca_cert, 'satellite_ca_certs': satellite_ca_certs, 'rhsm_katello_default_ca': rhsm_katello_default_ca } failed, tested = doctest.testmod(ssl_certificate, globs=globs) assert failed == 0
def test_doc(): cert = ssl_certificate.CertificateInfo(context_wrap(CERTIFICATE_OUTPUT1)) ca_cert = ssl_certificate.CertificateChain(context_wrap(CERTIFICATE_CHAIN_OUTPUT1)) satellite_ca_certs = ssl_certificate.SatelliteCustomCaChain(context_wrap(SATELLITE_OUTPUT2)) rhsm_katello_default_ca = ssl_certificate.RhsmKatelloDefaultCACert(context_wrap(RHSM_KATELLO_CERT_OUTPUT1)) date_info = ssl_certificate.HttpdSSLCertExpireDate(context_wrap(HTTPD_CERT_EXPIRE_INFO)) nginx_date_info = ssl_certificate.NginxSSLCertExpireDate(context_wrap(HTTPD_CERT_EXPIRE_INFO, args='/a/b/c.pem')) mssql_date_info = ssl_certificate.MssqlTLSCertExpireDate(context_wrap(MSSQL_CERT_EXPIRE_INFO)) globs = { 'cert': cert, 'certs': ca_cert, 'satellite_ca_certs': satellite_ca_certs, 'rhsm_katello_default_ca': rhsm_katello_default_ca, 'date_info': date_info, 'nginx_date_info': nginx_date_info, 'mssql_date_info': mssql_date_info } failed, _ = doctest.testmod(ssl_certificate, globs=globs) assert failed == 0