Projekt

Obecné

Profil

« Předchozí | Další » 

Revize f76b8017

Přidáno uživatelem Jan Pašek před téměř 4 roky(ů)

Re #8576 - Added integration test for empty CRL

Zobrazit rozdíly:

tests/integration_tests/services/crl_service_test.py
187 187
    private_key_service_unique.delete_key(root_ca_cert.private_key_id)
188 188
    with pytest.raises(PrivateKeyNotFoundException) as e:
189 189
        crl_service_unique.generate_crl_response(root_ca_cert.certificate_id)
190

  
191

  
192
def test_generate_empty_crl_response(certificate_service_unique, private_key_service_unique, crl_service_unique,
193
                                     cryptography_service):
194
    root_ca_private_key = private_key_service_unique.create_new_key(passphrase="foobar")
195

  
196
    root_ca_cert = certificate_service_unique.create_root_ca(root_ca_private_key,
197
                                                             Subject(common_name="RootFoo",
198
                                                                     organization_unit="Department of Foo"))
199

  
200
    # generate crl and decode it using openssl
201
    crl = crl_service_unique.generate_crl_response(root_ca_cert.certificate_id)
202
    with TemporaryFile("crl.pem", crl) as crl_file:
203
        proc = subprocess.Popen(["openssl", "crl", "-in", crl_file, "-noout", "-text"], stdin=None,
204
                                stdout=subprocess.PIPE,
205
                                stderr=subprocess.PIPE)
206

  
207
        out, err = proc.communicate(None)
208

  
209
    assert "No Revoked Certificates." in out.decode("utf-8")

Také k dispozici: Unified diff