Add a test case for search_typical_logs.

Change-Id: Iba60ae595f64dce9ea3422e1e1249b5e6922655b
This commit is contained in:
hejunli
2022-11-14 17:40:05 +08:00
parent 79e14f3df2
commit 16b0cbdfc1

View File

@@ -95,3 +95,11 @@ class TestSearchController(unittest.TestCase):
'?end_time=1')
res1 = self.controller.search_analyse_logs(req)
self.assertEqual(ret, res1)
@mock.patch('venus.modules.search.action.SearchCore.typical_logs')
def test_search_typical_logs_invalid_param(self, action_typical_logs):
ret = {"code": -1, "msg": "invalid param"}
action_typical_logs.return_value = ret
req = fakes.HTTPRequest.blank('?type=None')
res1 = self.controller.search_typical_logs(req)
self.assertEqual(ret, res1)