Exemplo n.º 1
0
def test_kafkastorage_ssl_log_replace_client_key_path(
        mock_create_kafka_consumer, caplog):
    storage.KafkaStorage('test',
                         extra_config={'ssl.key.location': 'location'},
                         ssl=SSL('/ca', '/cert', '/key'))
    assert 'KafkaStorage `ssl.key.location` '\
           'in config replaced with SSL object!' in caplog.messages
Exemplo n.º 2
0
def test_kafkastorage_ssl_replace_client_cert_path(mock_create_kafka_consumer):
    kafka = storage.KafkaStorage(
        'test',
        extra_config={'ssl.certificate.location': 'location'},
        ssl=SSL('/ca', '/cert', '/key'))

    assert kafka.extra_config['ssl.certificate.location'] == '/cert'
Exemplo n.º 3
0
def test_zookeeper_pass_ssl_cert_as_string(mock_kazoo_client):
    ZookeeperDatabase(['https://127.0.0.1:2181', 'https://127.0.0.2:2181'],
                      'zk_namespace',
                      ssl=SSL(server_verify='/path/to/sever_cert'))
Exemplo n.º 4
0
def test_zookeeper_raise_exception_when_invalid_ssl(mock_kazoo_client):
    with pytest.raises(ValidationError):
        ZookeeperDatabase(['https://127.0.0.1:2181', 'https://127.0.0.2:2181'],
                          'zk_namespace',
                          ssl=SSL(server_verify=123))
Exemplo n.º 5
0
def test_kafkastorage_ssl_log_using_own_cipher_suites(
        mock_create_kafka_consumer, caplog):
    storage.KafkaStorage('test',
                         extra_config={'ssl.cipher.suites': 'ciphers'},
                         ssl=SSL('/ca', '/cert', '/key'))
    assert 'KafkaStorage SSL uses extra config cipher suites!' in caplog.messages
Exemplo n.º 6
0
def test_kafkastorage_ssl_assign_cipher_suites(mock_create_kafka_consumer):
    assert storage.KafkaStorage('test', ssl=SSL('/ca', '/cert', '/key'))\
            .extra_config['ssl.cipher.suites'] == SECURE_CIPHERS
Exemplo n.º 7
0
def test_kafkastorage_ssl_exception_no_both_client_key_cert(
        mock_create_kafka_consumer):
    with pytest.raises(storage.KafkaConsumerInitializationException):
        storage.KafkaStorage('test', ssl=SSL('/ca', '/cert'))
Exemplo n.º 8
0
def test_kafkastorage_ssl_exception_no_ca_cert_path(
        mock_create_kafka_consumer):
    with pytest.raises(storage.KafkaConsumerInitializationException):
        storage.KafkaStorage('test', ssl=SSL(True, '/cert', '/key'))
Exemplo n.º 9
0
def test_kafkastorage_ssl_log_using_own_cipher_suites(mock_create_kafka_consumer, mock_log):
    storage.KafkaStorage(
            'test', extra_config={'ssl.cipher.suites': 'ciphers'}, ssl=SSL('/ca', '/cert', '/key'))
    mock_log.warning.assert_called_once_with('KafkaStorage SSL uses extra config cipher suites!')
Exemplo n.º 10
0
def test_kafkastorage_ssl_log_replace_client_key_path(mock_create_kafka_consumer, mock_log):
    storage.KafkaStorage(
            'test', extra_config={'ssl.key.location': 'location'},
            ssl=SSL('/ca', '/cert', '/key'))
    mock_log.warning.assert_called_once_with('KafkaStorage `ssl.key.location` '
                                             'in config replaced with SSL object!')