From 28635ed6f114cc5e909abd0180a62e8c24493066 Mon Sep 17 00:00:00 2001 From: hejunli Date: Thu, 14 Jul 2022 10:40:17 +0800 Subject: [PATCH] Supplement test cases for test_generate_must. In test_generate_must_lower, if the input is uppercase, the output will change them to lowercase. If k is not 'keyword', test_generate_must_other is entered. Change-Id: I51212cb48ef7f94c09445469aa4025430e9375a3 --- venus/tests/unit/api/test_search_action.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/venus/tests/unit/api/test_search_action.py b/venus/tests/unit/api/test_search_action.py index bfbb10c..ae80470 100644 --- a/venus/tests/unit/api/test_search_action.py +++ b/venus/tests/unit/api/test_search_action.py @@ -225,6 +225,18 @@ class TestSearchAction(unittest.TestCase): expected = [{'terms': {'log_level.keyword': ['test', 'TEST']}}] self.assertEqual(expected, result) + def test_generate_must_lower(self): + action = SearchCore() + result = action.generate_must({'log_level.keyword': 'TEST'}) + expected = [{'terms': {'log_level.keyword': ['TEST', 'test']}}] + self.assertEqual(expected, result) + + def test_generate_must_other(self): + action = SearchCore() + result = action.generate_must({'key': ['value1', 'value2']}) + expected = [{'match_phrase': {'key': {'query': ['value1', 'value2']}}}] + self.assertEqual(expected, result) + def test_generate_must_not(self): action = SearchCore() result = action.generate_must_not({'log_level.keyword':