コード例 #1
0
def test_wrong_credentials_with_ntlm(opt_adcs, opt_username, opt_password):
    with pytest.raises(RequestException) as excinfo:
        certsrv.get_existing_cert(opt_adcs,
                                  -1,
                                  'wronguser',
                                  'wrongpassword',
                                  auth_method='ntlm')
    assert excinfo.value.response.reason == 'Unauthorized'
コード例 #2
0
def test_get_existing_cert_with_wrong_cafile(opt_adcs):
    dir_path = os.path.dirname(os.path.realpath(__file__))
    ca_bundle = '%s/test_dummy-ca-cert.pem' % dir_path
    with pytest.raises(SSLError) as excinfo:
        certsrv.get_existing_cert(opt_adcs,
                                  1,
                                  'username',
                                  'password',
                                  cafile=ca_bundle)
コード例 #3
0
ファイル: test_certsrv.py プロジェクト: ylfingr/certsrv
def test_get_existing_cert_der(opt_adcs, opt_username, opt_password):
    # Request number 1 should always exist, right?
    der_cert = certsrv.get_existing_cert(opt_adcs, 1, opt_username, opt_password, 'bin')
    cert = OpenSSL.crypto.load_certificate(OpenSSL.crypto.FILETYPE_ASN1, der_cert)
コード例 #4
0
ファイル: test_certsrv.py プロジェクト: ylfingr/certsrv
def test_get_existing_cert_pem(opt_adcs, opt_username, opt_password):
    # Request number 1 should always exist, right?
    pem_cert = certsrv.get_existing_cert(opt_adcs, 1, opt_username, opt_password)
    cert = OpenSSL.crypto.load_certificate(OpenSSL.crypto.FILETYPE_PEM, pem_cert)
コード例 #5
0
ファイル: test_certsrv.py プロジェクト: ylfingr/certsrv
def test_get_non_existing_cert(opt_adcs, opt_username, opt_password):
    with pytest.raises(certsrv.CouldNotRetrieveCertificateException) as excinfo:
        certsrv.get_existing_cert(opt_adcs, -1, opt_username, opt_password)
コード例 #6
0
ファイル: test_certsrv.py プロジェクト: ylfingr/certsrv
def test_get_existing_cert_with_wrong_cafile(opt_adcs):
    dir_path = os.path.dirname(os.path.realpath(__file__))
    ca_bundle = '%s/test_dummy-ca-cert.pem' % dir_path
    with pytest.raises(URLError) as excinfo:
        certsrv.get_existing_cert(opt_adcs, 1, 'username', 'password', cafile=ca_bundle)
    assert excinfo.value.reason.reason == 'CERTIFICATE_VERIFY_FAILED'
コード例 #7
0
ファイル: test_certsrv.py プロジェクト: ylfingr/certsrv
def test_wrong_credentials_with_ntlm(opt_adcs, opt_username, opt_password):
    # We should throw a HTTPError even when ntlm auth
    with pytest.raises(HTTPError) as excinfo:
        certsrv.get_existing_cert(opt_adcs, -1, 'wronguser', 'wrongpassword', auth_method='ntlm')
    assert excinfo.value.msg == 'Unauthorized'
コード例 #8
0
ファイル: test_certsrv.py プロジェクト: ylfingr/certsrv
def test_wrong_credentials(opt_adcs, opt_username, opt_password):
    with pytest.raises(HTTPError) as excinfo:
        certsrv.get_existing_cert(opt_adcs, -1, 'wronguser', 'wrongpassword')
    assert excinfo.value.msg == 'Unauthorized'