Skip to content

Commit

Permalink
Merge pull request #182 from cfpb/remove-es7-host-var
Browse files Browse the repository at this point in the history
Remove last bit of ES7 conversion references
  • Loading branch information
higs4281 authored Nov 8, 2021
2 parents c2d5332 + 3462572 commit 8174b71
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 22 deletions.
5 changes: 1 addition & 4 deletions complaint_search/es_interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,17 +30,14 @@
os.environ.get('ES_PORT', '9200'))
_ES_USER = os.environ.get('ES_USER', '')
_ES_PASSWORD = os.environ.get('ES_PASSWORD', '')

_ES_INSTANCE = None

USE_AWS_ES = os.environ.get('USE_AWS_ES', False)
AWS_ES_ACCESS_KEY = os.environ.get('AWS_ES_ACCESS_KEY')
AWS_ES_SECRET_KEY = os.environ.get('AWS_ES_SECRET_KEY')
AWS_ES_HOST = os.environ.get('ES7_HOST')

AWS_ES_HOST = os.environ.get('ES_HOST')

_COMPLAINT_ES_INDEX = os.environ.get('COMPLAINT_ES_INDEX', 'complaint-index')
_COMPLAINT_DOC_TYPE = os.environ.get('COMPLAINT_DOC_TYPE', 'complaint-doctype')


# -----------------------------------------------------------------------------
Expand Down
21 changes: 3 additions & 18 deletions complaint_search/tests/test_es_interface_trends.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@
class EsInterfaceTestTrends(TestCase):

@mock.patch("complaint_search.es_interface._COMPLAINT_ES_INDEX", "INDEX")
@mock.patch(
"complaint_search.es_interface._COMPLAINT_DOC_TYPE", "DOC_TYPE")
@mock.patch.object(Elasticsearch, 'count')
@mock.patch.object(Elasticsearch, 'search')
def test_trends_default_params__valid(self, mock_search, mock_count):
Expand All @@ -28,8 +26,6 @@ def test_trends_default_params__valid(self, mock_search, mock_count):
self.assertEqual(body, res)

@mock.patch("complaint_search.es_interface._COMPLAINT_ES_INDEX", "INDEX")
@mock.patch("complaint_search.es_interface._COMPLAINT_DOC_TYPE",
"DOC_TYPE")
@mock.patch.object(Elasticsearch, 'count')
@mock.patch.object(Elasticsearch, 'search')
def test_trends_sub_lens_product__valid(self, mock_search, mock_count):
Expand All @@ -50,8 +46,6 @@ def test_trends_sub_lens_product__valid(self, mock_search, mock_count):
self.assertEqual(body, res)

@mock.patch("complaint_search.es_interface._COMPLAINT_ES_INDEX", "INDEX")
@mock.patch("complaint_search.es_interface._COMPLAINT_DOC_TYPE",
"DOC_TYPE")
@mock.patch.object(Elasticsearch, 'count')
@mock.patch.object(Elasticsearch, 'search')
def test_trends_exclude_and_date_filters__valid(self,
Expand All @@ -75,8 +69,6 @@ def test_trends_exclude_and_date_filters__valid(self,
self.assertEqual(body, res)

@mock.patch("complaint_search.es_interface._COMPLAINT_ES_INDEX", "INDEX")
@mock.patch("complaint_search.es_interface._COMPLAINT_DOC_TYPE",
"DOC_TYPE")
@mock.patch.object(Elasticsearch, 'count')
@mock.patch.object(Elasticsearch, 'search')
def test_trends_filter__valid(self, mock_search, mock_count):
Expand All @@ -98,8 +90,6 @@ def test_trends_filter__valid(self, mock_search, mock_count):
self.assertEqual(body, res)

@mock.patch("complaint_search.es_interface._COMPLAINT_ES_INDEX", "INDEX")
@mock.patch("complaint_search.es_interface._COMPLAINT_DOC_TYPE",
"DOC_TYPE")
@mock.patch.object(Elasticsearch, 'count')
@mock.patch.object(Elasticsearch, 'search')
def test_trends_top_self_filter__valid(self, mock_search, mock_count):
Expand All @@ -120,8 +110,6 @@ def test_trends_top_self_filter__valid(self, mock_search, mock_count):
self.assertTrue('company' not in res['aggregations'])

@mock.patch("complaint_search.es_interface._COMPLAINT_ES_INDEX", "INDEX")
@mock.patch("complaint_search.es_interface._COMPLAINT_DOC_TYPE",
"DOC_TYPE")
@mock.patch.object(Elasticsearch, 'count')
@mock.patch.object(Elasticsearch, 'search')
def test_trends_company_filter__valid(self, mock_search, mock_count):
Expand All @@ -142,8 +130,6 @@ def test_trends_company_filter__valid(self, mock_search, mock_count):
self.assertTrue('company' in res['aggregations'])

@mock.patch("complaint_search.es_interface._COMPLAINT_ES_INDEX", "INDEX")
@mock.patch("complaint_search.es_interface._COMPLAINT_DOC_TYPE",
"DOC_TYPE")
@mock.patch.object(Elasticsearch, 'count')
@mock.patch.object(Elasticsearch, 'search')
def test_trends_issue_focus__valid(self, mock_search, mock_count):
Expand All @@ -167,8 +153,6 @@ def test_trends_issue_focus__valid(self, mock_search, mock_count):
1)

@mock.patch("complaint_search.es_interface._COMPLAINT_ES_INDEX", "INDEX")
@mock.patch("complaint_search.es_interface._COMPLAINT_DOC_TYPE",
"DOC_TYPE")
@mock.patch.object(Elasticsearch, 'count')
@mock.patch.object(Elasticsearch, 'search')
def test_trends_issue_focus_company_filter__valid(self,
Expand All @@ -191,5 +175,6 @@ def test_trends_issue_focus_company_filter__valid(self,
self.assertEqual(len(mock_search.call_args), 2)
self.assertEqual(mock_search.call_args[1]['index'], 'INDEX')
self.assertTrue('company' in res['aggregations'])
self.assertEqual(len(res['aggregations']['issue']['issue']['buckets']),
1)
self.assertEqual(
len(res['aggregations']['issue']['issue']['buckets']), 1
)

0 comments on commit 8174b71

Please sign in to comment.