Unit test may failed without client_factory.init()

Such as the title

Change-Id: Ia1e77d29332ddbfb9462fa093858c1e9cda90b78
(cherry picked from commit ec8e3bbcfb)
This commit is contained in:
chenying 2017-02-14 04:49:04 +08:00 committed by xiangxinyong
parent 23812aec34
commit 1e37b7f26a
1 changed files with 5 additions and 0 deletions

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 BankPlugin
from karbor.services.protection.bank_plugin import BankSection
from karbor.services.protection import client_factory
from karbor.services.protection.protection_plugins.server \
import server_plugin_schemas
from karbor.services.protection.protection_plugins.server. \
@ -277,6 +278,10 @@ def call_hooks(operation, checkpoint, resource, context, parameters, **kwargs):
class NovaProtectionPluginTest(base.TestCase):
def setUp(self):
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',
project_id='abcd',
auth_token='efgh')