Merge "add @mock.patch to test_get_all_index"
This commit is contained in:
commit
f1de0302e9
@ -135,8 +135,12 @@ class TestSearchAction(unittest.TestCase):
|
|||||||
index_names = self.action.get_all_index('test_index')
|
index_names = self.action.get_all_index('test_index')
|
||||||
self.assertEqual("", index_names)
|
self.assertEqual("", index_names)
|
||||||
|
|
||||||
|
@mock.patch('venus.modules.search.es_template.search_params')
|
||||||
|
@mock.patch('venus.modules.search.action.SearchCore.get_index_names')
|
||||||
@mock.patch('venus.common.utils.request_es')
|
@mock.patch('venus.common.utils.request_es')
|
||||||
def test_get_all_index(self, mock_req_es):
|
def test_get_all_index(
|
||||||
|
self, mock_req_es, mock_get_index_names, mock_search_params):
|
||||||
|
mock_get_index_names.return_value = 'flog-2021.01.03,flog-2021.01.04'
|
||||||
mock_req_es.return_value = (
|
mock_req_es.return_value = (
|
||||||
200, '[{"index":"index1"},{"index":"index2"}]')
|
200, '[{"index":"index1"},{"index":"index2"}]')
|
||||||
index_names = self.action.get_all_index('test_index')
|
index_names = self.action.get_all_index('test_index')
|
||||||
|
Loading…
Reference in New Issue
Block a user