Add unit test for controller api
Change-Id: I5424c2ec3c3b1fe4bf1bbdb4f4f6dee6578de0a8
This commit is contained in:
parent
93184e1e25
commit
16ac2c94d9
30
venus/tests/unit/api/test_search_controller.py
Normal file
30
venus/tests/unit/api/test_search_controller.py
Normal file
@ -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()
|
Loading…
x
Reference in New Issue
Block a user