kopia lustrzana https://github.com/wagtail/wagtail
Add a check for a string value in Elasticsearch 'URLS' setting
rodzic
f2dfff8061
commit
bcf1fab77f
|
@ -1070,6 +1070,10 @@ class Elasticsearch2SearchBackend(BaseSearchBackend):
|
||||||
if self.hosts is None:
|
if self.hosts is None:
|
||||||
self.hosts = []
|
self.hosts = []
|
||||||
|
|
||||||
|
# if es_urls is not a list, convert it to a list
|
||||||
|
if isinstance(es_urls, str):
|
||||||
|
es_urls = [es_urls]
|
||||||
|
|
||||||
for url in es_urls:
|
for url in es_urls:
|
||||||
parsed_url = urlparse(url)
|
parsed_url = urlparse(url)
|
||||||
|
|
||||||
|
|
|
@ -833,6 +833,25 @@ class TestBackendConfiguration(TestCase):
|
||||||
timeout=10
|
timeout=10
|
||||||
)
|
)
|
||||||
|
|
||||||
|
def test_urls_as_string_works(self, Elasticsearch):
|
||||||
|
Elasticsearch2SearchBackend(params={
|
||||||
|
'URLS': 'http://localhost:9200'
|
||||||
|
})
|
||||||
|
|
||||||
|
Elasticsearch.assert_called_with(
|
||||||
|
hosts=[
|
||||||
|
{
|
||||||
|
'host': 'localhost',
|
||||||
|
'port': 9200,
|
||||||
|
'url_prefix': '',
|
||||||
|
'use_ssl': False,
|
||||||
|
'verify_certs': False,
|
||||||
|
'http_auth': None,
|
||||||
|
}
|
||||||
|
],
|
||||||
|
timeout=10
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
class TestGetModelRoot(TestCase):
|
class TestGetModelRoot(TestCase):
|
||||||
def test_root_model(self):
|
def test_root_model(self):
|
||||||
|
|
Ładowanie…
Reference in New Issue