diff --git a/venus/tests/unit/api/test_search_controller.py b/venus/tests/unit/api/test_search_controller.py new file mode 100644 index 0000000..6e570fe --- /dev/null +++ b/venus/tests/unit/api/test_search_controller.py @@ -0,0 +1,30 @@ +# Copyright 2022 Inspur +# +# Licensed under the Apache License, Version 2.0 (the "License"); you may +# not use this file except in compliance with the License. You may obtain +# a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations +# under the License. + +import unittest +from unittest import mock + +from elasticsearch import Elasticsearch +from venus.api import extensions +from venus.modules.search.controller import SearchController +from venus.tests.unit import fakes + + +class TestSearchController(unittest.TestCase): + @mock.patch('elasticsearch.Elasticsearch') + def setUp(self, mock_es): + mock_es.return_value = Elasticsearch() + self.controller = SearchController(extensions.ExtensionManager) + self.req = fakes.HTTPRequest.blank('') + super(TestSearchController, self).setUp()