def test_prepare_server_test_settings_not_exists(self): """Assert raise when the argument given is not a configured server.""" servers = { 'default': { 'ENGINE': 'djangoes.backends.elasticsearch.SimpleHttpBackend' } } indices = {} handler = ConnectionHandler(servers, indices) with self.assertRaises(ConnectionDoesNotExist) as raised: handler.prepare_server_test_settings('index') assert str(raised.exception) == '%r' % 'index'
def test_empty_prepare_server_test_settings(self): """Assert prepare adds a TEST key in the defaul server's settings.""" servers = { 'default': { 'ENGINE': 'djangoes.backends.elasticsearch.SimpleHttpBackend' } } handler = ConnectionHandler(servers, {}) handler.prepare_server_test_settings('default') default_server = handler.servers['default'] expected_test_server = {'INDICES': []} assert 'TEST' in default_server assert default_server['TEST'] == expected_test_server
def test_empty_prepare_server_test_settings(self): """Assert prepare adds a TEST key in the defaul server's settings.""" servers = { 'default': { 'ENGINE': 'djangoes.backends.elasticsearch.SimpleHttpBackend' } } handler = ConnectionHandler(servers, {}) handler.prepare_server_test_settings('default') default_server = handler.servers['default'] expected_test_server = { 'INDICES': [] } assert 'TEST' in default_server assert default_server['TEST'] == expected_test_server