From 4c33371379d37101ec924b6bfbc4ea19d06cb867 Mon Sep 17 00:00:00 2001 From: hejunli Date: Mon, 14 Nov 2022 17:59:22 +0800 Subject: [PATCH] Supplement a test case 'no_index' for typical_logs. Change-Id: Idc7b9e300187c350192482e1f8104f3a39d33cff --- venus/tests/unit/api/test_search_controller.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/venus/tests/unit/api/test_search_controller.py b/venus/tests/unit/api/test_search_controller.py index 7c33d00..dd2fcfa 100644 --- a/venus/tests/unit/api/test_search_controller.py +++ b/venus/tests/unit/api/test_search_controller.py @@ -103,3 +103,12 @@ class TestSearchController(unittest.TestCase): req = fakes.HTTPRequest.blank('?type=None') res1 = self.controller.search_typical_logs(req) 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)