Unit test may failed without client_factory.init()

Such as the title

Change-Id: Ia1e77d29332ddbfb9462fa093858c1e9cda90b78
This commit is contained in:
chenying 2017-02-14 04:49:04 +08:00
parent 0fae025798
commit ec8e3bbcfb

View File

@ -19,6 +19,7 @@ from karbor.resource import Resource
from karbor.services.protection.bank_plugin import Bank from karbor.services.protection.bank_plugin import Bank
from karbor.services.protection.bank_plugin import BankPlugin from karbor.services.protection.bank_plugin import BankPlugin
from karbor.services.protection.bank_plugin import BankSection from karbor.services.protection.bank_plugin import BankSection
from karbor.services.protection import client_factory
from karbor.services.protection.protection_plugins.server \ from karbor.services.protection.protection_plugins.server \
import server_plugin_schemas import server_plugin_schemas
from karbor.services.protection.protection_plugins.server. \ from karbor.services.protection.protection_plugins.server. \
@ -277,6 +278,10 @@ def call_hooks(operation, checkpoint, resource, context, parameters, **kwargs):
class NovaProtectionPluginTest(base.TestCase): class NovaProtectionPluginTest(base.TestCase):
def setUp(self): def setUp(self):
super(NovaProtectionPluginTest, self).setUp() super(NovaProtectionPluginTest, self).setUp()
with mock.patch.object(
client_factory.karbor_keystone_plugin.KarborKeystonePlugin,
'_do_init'):
client_factory.init()
self.cntxt = RequestContext(user_id='demo', self.cntxt = RequestContext(user_id='demo',
project_id='abcd', project_id='abcd',
auth_token='efgh') auth_token='efgh')