Supplement a test case 'no_index' for typical_logs.

Change-Id: Idc7b9e300187c350192482e1f8104f3a39d33cff
This commit is contained in:
hejunli 2022-11-14 17:59:22 +08:00
parent 16b0cbdfc1
commit 4c33371379

View File

@ -103,3 +103,12 @@ class TestSearchController(unittest.TestCase):
req = fakes.HTTPRequest.blank('?type=None') req = fakes.HTTPRequest.blank('?type=None')
res1 = self.controller.search_typical_logs(req) res1 = self.controller.search_typical_logs(req)
self.assertEqual(ret, res1) self.assertEqual(ret, res1)
@mock.patch('venus.modules.search.action.SearchCore.typical_logs')
def test_search_typical_logs_no_index(self, action_typical_logs):
ret = {"code": 0, "msg": "no data, no index"}
action_typical_logs.return_value = ret
req = fakes.HTTPRequest.blank('?type=error_stats?start_time=2&'
'?end_time=1')
res1 = self.controller.search_typical_logs(req)
self.assertEqual(ret, res1)