Example #1
0
    def test_configures_aws_auth(self, es_mock, awsauth_mock):
        get_client({'elasticsearch_host': 'foo',
                    'elasticsearch_port': 9200,
                    'elasticsearch_aws_access_key_id': 'foo',
                    'elasticsearch_aws_secret_access_key': 'bar',
                    'elasticsearch_aws_region': 'spain'})

        awsauth_mock.assert_called_once_with('foo', 'bar', 'spain', 'es')
Example #2
0
    def test_configures_aws_auth(self, es_mock, awsauth_mock):
        get_client({'elasticsearch_host': 'foo',
                    'elasticsearch_port': 9200,
                    'elasticsearch_aws_access_key_id': 'foo',
                    'elasticsearch_aws_secret_access_key': 'bar',
                    'elasticsearch_aws_region': 'spain'})

        awsauth_mock.assert_called_once_with('foo', 'bar', 'spain', 'es')
Example #3
0
    def test_configures_es_for_aws_auth(self, es_mock, awsauth_mock):
        auth_result = awsauth_mock.return_value
        get_client({'elasticsearch_host': 'foo',
                    'elasticsearch_port': 9200,
                    'elasticsearch_aws_access_key_id': 'foo',
                    'elasticsearch_aws_secret_access_key': 'bar',
                    'elasticsearch_aws_region': 'spain'})

        es_mock.assert_called_once_with([{'host': 'foo', 'port': 9200}],
                                        http_auth=auth_result,
                                        use_ssl=True,
                                        verify_certs=True,
                                        ca_certs=certifi.where(),
                                        connection_class=RequestsHttpConnection)
Example #4
0
    def test_configures_es_for_aws_auth(self, es_mock, awsauth_mock):
        auth_result = awsauth_mock.return_value
        get_client({'elasticsearch_host': 'foo',
                    'elasticsearch_port': 9200,
                    'elasticsearch_aws_access_key_id': 'foo',
                    'elasticsearch_aws_secret_access_key': 'bar',
                    'elasticsearch_aws_region': 'spain'})

        es_mock.assert_called_once_with([{'host': 'foo', 'port': 9200}],
                                        http_auth=auth_result,
                                        use_ssl=True,
                                        verify_certs=True,
                                        ca_certs=certifi.where(),
                                        connection_class=(
                                            RequestsHttpConnection))
Example #5
0
    def test_returns_client(self):
        client = get_client({
            'elasticsearch_host': 'foo',
            'elasticsearch_port': 9200
        })

        assert isinstance(client, Elasticsearch)
Example #6
0
    def test_configures_client(self, es_mock):
        get_client({'elasticsearch_host': 'foo', 'elasticsearch_port': 9200})

        es_mock.assert_called_once_with([{'host': 'foo', 'port': 9200}])
Example #7
0
    def test_configures_client(self, es_mock):
        get_client({'elasticsearch_url': 'foo:9200'})

        es_mock.assert_called_once_with(['foo:9200'])
Example #8
0
    def test_returns_client(self):
        client = get_client({'elasticsearch_url': 'foo:9200'})

        assert isinstance(client, Elasticsearch)
Example #9
0
    def test_configures_client(self, es_mock):
        get_client({'elasticsearch_host': 'foo',
                    'elasticsearch_port': 9200})

        es_mock.assert_called_once_with([{'host': 'foo', 'port': 9200}])
Example #10
0
    def test_returns_client(self):
        client = get_client({'elasticsearch_host': 'foo',
                             'elasticsearch_port': 9200})

        assert isinstance(client, Elasticsearch)
Example #11
0
    def test_returns_client(self):
        client = get_client({"elasticsearch_url": "foo:9200"})

        assert isinstance(client, Elasticsearch)
Example #12
0
    def test_configures_client(self, es_mock):
        get_client({"elasticsearch_url": "foo:9200"})

        es_mock.assert_called_once_with(["foo:9200"])