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)
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 == []
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 == []
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']