Add a test cases for unit tests

Add a test case to 'generate_must' so that if there are lowercase characters
in the input, it will be uppercase in the output.

Change-Id: I50443af0aa040cee228b539dbea2ba4b990e7d73
This commit is contained in:
hejunli 2022-07-08 19:20:56 +08:00
parent 7c3ec56142
commit e16dcbd989

View File

@ -219,6 +219,12 @@ class TestSearchAction(unittest.TestCase):
expected = {'code': 1, 'msg': 'OK', "values": ['val1', 'val2']} expected = {'code': 1, 'msg': 'OK', "values": ['val1', 'val2']}
self.assertEqual(expected, result) self.assertEqual(expected, result)
def test_generate_must_upper(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_not(self): def test_generate_must_not(self):
action = SearchCore() action = SearchCore()
result = action.generate_must_not({'log_level.keyword': result = action.generate_must_not({'log_level.keyword':