예제 #1
0
    def test_loading_elasticsearch(self):
        servers = {
            'default': {
                'ENGINE': 'djangoes.backends.elasticsearch.SimpleHttpBackend'
            }
        }
        indices = {}

        handler = ConnectionHandler(servers, indices)

        result = handler.load_backend('default')

        assert isinstance(result, elasticsearch.SimpleHttpBackend)
예제 #2
0
    def test_load_backend(self):
        """Assert load_backend method loads the configured server engine."""
        servers = {'default': {'ENGINE': 'tests.backend.ConnectionWrapper'}}
        indices = {}
        handler = ConnectionHandler(servers, indices)

        result = handler.load_backend('default')

        assert isinstance(result, Base)
        assert result.alias == 'default'
        assert result.indices == []
        assert result.index_names == []
        assert result.alias_names == []
예제 #3
0
    def test_loading_elasticsearch(self):
        servers = {
            'default': {
                'ENGINE': 'djangoes.backends.elasticsearch.SimpleHttpBackend'
            }
        }
        indices = {}

        handler = ConnectionHandler(servers, indices)

        result = handler.load_backend('default')

        assert isinstance(result, elasticsearch.SimpleHttpBackend)
예제 #4
0
    def test_load_backend(self):
        """Assert load_backend method loads the configured server engine."""
        servers = {
            'default': {
                'ENGINE': 'tests.backend.ConnectionWrapper'
            }
        }
        indices = {}
        handler = ConnectionHandler(servers, indices)

        result = handler.load_backend('default')

        assert isinstance(result, Base)
        assert result.alias == 'default'
        assert result.indices == []
        assert result.index_names == []
        assert result.alias_names == []
예제 #5
0
    def test_load_backend_with_index(self):
        servers = {
            'default': {
                'ENGINE': 'tests.backend.ConnectionWrapper',
                'INDICES': ['index_1'],
            }
        }
        indices = {
            'index_1': {
                'NAME': 'index_1',
                'ALIASES': ['alias_1', 'alias_2'],
            }
        }
        handler = ConnectionHandler(servers, indices)

        result = handler.load_backend('default')

        assert sorted(result.indices) == ['alias_1', 'alias_2']
        assert result.index_names == ['index_1']
        assert sorted(result.alias_names) == ['alias_1', 'alias_2']
예제 #6
0
    def test_load_backend_with_index(self):
        servers = {
            'default': {
                'ENGINE': 'tests.backend.ConnectionWrapper',
                'INDICES': ['index_1'],
            }
        }
        indices = {
            'index_1': {
                'NAME': 'index_1',
                'ALIASES': ['alias_1', 'alias_2'],
            }
        }
        handler = ConnectionHandler(servers, indices)

        result = handler.load_backend('default')

        assert sorted(result.indices) == ['alias_1', 'alias_2']
        assert result.index_names == ['index_1']
        assert sorted(result.alias_names) == ['alias_1', 'alias_2']