Skip to content
This repository has been archived by the owner on Aug 2, 2019. It is now read-only.

Commit

Permalink
Fix flake8
Browse files Browse the repository at this point in the history
  • Loading branch information
Rémy HUBSCHER committed Nov 12, 2014
1 parent 8edda0c commit d28e89b
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 8 deletions.
3 changes: 2 additions & 1 deletion daybed/indexer/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ def build_elasticsearch_hosts(hosts):
"""Take a list of hosts and build an Elasticsearch parameter list.
>>> build_elasticsearch_hosts(['https://admin:password@localhost'])
[{'use_ssl': True, 'host': 'localhost', 'http_auth': 'admin:password', 'port': 443}]
[{'use_ssl': True, 'host': 'localhost', 'http_auth': 'admin:password', \
'port': 443}]
"""
built_hosts = []
Expand Down
15 changes: 8 additions & 7 deletions daybed/tests/test_indexer.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@

from daybed.schemas import registry
from daybed import indexer
from daybed.indexer.utils import build_elasticsearch_hosts

from .support import BaseWebTest, unittest
from .test_views import MODEL_DEFINITION, MODEL_RECORD
Expand All @@ -15,17 +14,17 @@ class ConfigurationTest(unittest.TestCase):

@mock.patch('elasticsearch.Elasticsearch')
def test_default_config(self, elasticsearch_mock):
new_indexer = indexer.ElasticSearchIndexer(['localhost:9200'], 'daybed_')
indexer.ElasticSearchIndexer(['localhost:9200'], 'daybed_')
elasticsearch_mock.assert_called_with(['localhost:9200'])

@mock.patch('elasticsearch.Elasticsearch')
def test_default_port(self, elasticsearch_mock):
new_indexer = indexer.ElasticSearchIndexer(['localhost'], 'daybed_')
indexer.ElasticSearchIndexer(['localhost'], 'daybed_')
elasticsearch_mock.assert_called_with(['localhost'])

@mock.patch('elasticsearch.Elasticsearch')
def test_http_url(self, elasticsearch_mock):
new_indexer = indexer.ElasticSearchIndexer(['http://localhost:9200'], 'daybed_')
indexer.ElasticSearchIndexer(['http://localhost:9200'], 'daybed_')
elasticsearch_mock.assert_called_with([{
'host': 'localhost',
'port': 9200,
Expand All @@ -35,7 +34,7 @@ def test_http_url(self, elasticsearch_mock):

@mock.patch('elasticsearch.Elasticsearch')
def test_https_url(self, elasticsearch_mock):
new_indexer = indexer.ElasticSearchIndexer(['https://localhost'], 'daybed_')
indexer.ElasticSearchIndexer(['https://localhost'], 'daybed_')
elasticsearch_mock.assert_called_with([{
'host': 'localhost',
'port': 443,
Expand All @@ -45,7 +44,8 @@ def test_https_url(self, elasticsearch_mock):

@mock.patch('elasticsearch.Elasticsearch')
def test_http_url_with_basic_auth(self, elasticsearch_mock):
new_indexer = indexer.ElasticSearchIndexer(['http://admin:password@localhost'], 'daybed_')
indexer.ElasticSearchIndexer(
['http://admin:password@localhost'], 'daybed_')
elasticsearch_mock.assert_called_with([{
'host': 'localhost',
'port': 80,
Expand All @@ -55,7 +55,8 @@ def test_http_url_with_basic_auth(self, elasticsearch_mock):

@mock.patch('elasticsearch.Elasticsearch')
def test_https_url_with_basic_auth(self, elasticsearch_mock):
new_indexer = indexer.ElasticSearchIndexer(['https://admin:password@localhost'], 'daybed_')
indexer.ElasticSearchIndexer(
['https://admin:password@localhost'], 'daybed_')
elasticsearch_mock.assert_called_with([{
'host': 'localhost',
'port': 443,
Expand Down

0 comments on commit d28e89b

Please sign in to comment.