示例#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
示例#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'
示例#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'))
示例#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))
示例#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
示例#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
示例#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'))
示例#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'))
示例#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!')
示例#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!')