Thanks to visit codestin.com
Credit goes to github.com

Skip to content
This repository was archived by the owner on Nov 22, 2017. It is now read-only.
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 10 additions & 5 deletions sheer/test_indexing.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,8 @@ def test_indexing(self, mock_exists, mock_read_json_file,

mock_es.indices.create.assert_called_with(index=self.config['index'])
mock_bulk.assert_called_with(mock_es,
self.mock_processor.documents())
self.mock_processor.documents(),
index='content')

@mock.patch('sheer.indexer.bulk')
@mock.patch('sheer.indexer.Elasticsearch')
Expand Down Expand Up @@ -123,7 +124,8 @@ def test_reindexing(self, mock_exists, mock_read_json_file,
mock_es.indices.delete.assert_called_with(self.config['index'])
mock_es.indices.create.assert_called_with(index=self.config['index'])
mock_bulk.assert_called_with(mock_es,
self.mock_processor.documents())
self.mock_processor.documents(),
index='content')

@mock.patch('sheer.indexer.bulk')
@mock.patch('sheer.indexer.Elasticsearch')
Expand Down Expand Up @@ -164,7 +166,8 @@ def test_partial_indexing(self, mock_exists, mock_read_json_file,
test_args = AttrDict(processors=['posts'], reindex=False)
index_location(test_args, self.config)
mock_bulk.assert_called_with(mock_es,
self.mock_processor.documents())
self.mock_processor.documents(),
index='content')

@mock.patch('sheer.indexer.bulk')
@mock.patch('sheer.indexer.Elasticsearch')
Expand Down Expand Up @@ -204,7 +207,8 @@ def test_partial_reindexing(self, mock_exists, mock_read_json_file,
index=self.config['index'],
doc_type='posts')
mock_bulk.assert_called_with(mock_es,
self.mock_processor.documents())
self.mock_processor.documents(),
index='content')

@mock.patch('sheer.indexer.bulk')
@mock.patch('sheer.indexer.Elasticsearch')
Expand Down Expand Up @@ -272,7 +276,8 @@ def test_indexing_failure_ioerr(self, mock_exists, mock_read_json_file,
assert 'error making connection' in sys.stderr.getvalue()

mock_bulk.assert_called_with(mock_es,
self.mock_processor.documents())
self.mock_processor.documents(),
index='content')

@mock.patch('sheer.indexer.bulk')
@mock.patch('sheer.indexer.Elasticsearch')
Expand Down