Beispiel #1
0
def test_deleted_certs_dont_exist_on_filesystem():
    with intermediate_certificate_authority(
            'root_ca2', 'intermediate_ca2') as (root_ca2, intermediate_ca2):
        # no-op
        pass
    with certificate_signing_request('csr_test2') as csr2:
        pass
    assert get_cert_current_files() == get_cert_expected_files()
Beispiel #2
0
def test_created_certs_exist_on_filesystem():
    with intermediate_certificate_authority(
            'root_ca', 'intermediate_ca') as (root_ca, intermediate_ca):
        with certificate_signing_request('csr_test') as csr:
            cert = call('certificate.create', {
                'name': 'cert_test',
                'signedby': intermediate_ca['id'],
                'create_type': 'CERTIFICATE_CREATE_INTERNAL',
                **get_cert_params(),
            },
                        job=True)
            try:
                assert get_cert_current_files() == get_cert_expected_files()
            finally:
                call('certificate.delete', cert['id'], job=True)
Beispiel #3
0
def test_signing_csr():
    with root_certificate_authority('root_ca') as root_ca:
        with certificate_signing_request('csr_test') as csr:
            cert = call(
                'certificateauthority.ca_sign_csr', {
                    'ca_id': root_ca['id'],
                    'csr_cert_id': csr['id'],
                    'name': 'signed_cert',
                })
            root_ca = call('certificateauthority.get_instance', root_ca['id'])
            try:
                assert isinstance(cert['signedby'], dict), cert
                assert cert['signedby']['id'] == root_ca['id'], cert
                assert cert['chain_list'] == [
                    cert['certificate'], root_ca['certificate']
                ]
                assert cert['issuer'] == root_ca, cert
            finally:
                call('certificate.delete', cert['id'], job=True)
Beispiel #4
0
def test_issuer_of_csr():
    with certificate_signing_request('csr_test') as csr:
        assert csr['issuer'] == 'external - signature pending', csr
Beispiel #5
0
def test_creating_csr():
    with certificate_signing_request('csr_test') as csr:
        assert csr['cert_type_CSR'] is True, csr