Merge "Fix wrong usage of novaclient"
This commit is contained in:
commit
23a4873b0f
@ -43,10 +43,10 @@ class CMDClientsTest(base.TestCase):
|
||||
ca_file=environ.get("OS_CACERT"))
|
||||
|
||||
@mock.patch('os.environ')
|
||||
@mock.patch('novaclient.v2.client.Client')
|
||||
@mock.patch('novaclient.client.Client')
|
||||
def test_get_nova_bm_client(self, client_mock, environ):
|
||||
clients.get_nova_bm_client()
|
||||
client_mock.assert_called_once_with(environ["OS_USERNAME"],
|
||||
client_mock.assert_called_once_with("2", environ["OS_USERNAME"],
|
||||
environ["OS_PASSWORD"],
|
||||
environ["OS_AUTH_URL"],
|
||||
environ["OS_TENANT_NAME"],
|
||||
|
@ -22,8 +22,8 @@ from keystoneclient import session
|
||||
from keystoneclient.v2_0 import client as ksclient
|
||||
from keystoneclient.v3 import client as ks3client
|
||||
from neutronclient.neutron import client as neutronclient
|
||||
from novaclient import client as nova_client
|
||||
from novaclient.extension import Extension
|
||||
from novaclient.v2 import client as novav11client
|
||||
from novaclient.v2.contrib import baremetal
|
||||
|
||||
LOG = logging.getLogger(__name__)
|
||||
@ -32,12 +32,8 @@ LOG = logging.getLogger(__name__)
|
||||
def get_nova_bm_client(username, password, tenant_name, auth_url, cacert=None):
|
||||
LOG.debug('Creating nova client.')
|
||||
baremetal_extension = Extension('baremetal', baremetal)
|
||||
return novav11client.Client(username,
|
||||
password,
|
||||
tenant_name,
|
||||
auth_url,
|
||||
extensions=[baremetal_extension],
|
||||
cacert=cacert)
|
||||
return nova_client.Client("2", username, password, tenant_name, auth_url,
|
||||
extensions=[baremetal_extension], cacert=cacert)
|
||||
|
||||
|
||||
def get_ironic_client(username, password, tenant_name, auth_url, cacert=None):
|
||||
|
@ -32,11 +32,11 @@ class ClientsTest(base.TestCase):
|
||||
os_tenant_name='tenant_name',
|
||||
ca_file=None)
|
||||
|
||||
@mock.patch('novaclient.v2.client.Client')
|
||||
@mock.patch('novaclient.client.Client')
|
||||
def test_get_nova_bm_client(self, client_mock):
|
||||
clients.get_nova_bm_client('username', 'password', 'tenant_name',
|
||||
'auth_url')
|
||||
client_mock.assert_called_once_with('username',
|
||||
client_mock.assert_called_once_with('2', 'username',
|
||||
'password',
|
||||
'tenant_name',
|
||||
'auth_url',
|
||||
|
Loading…
x
Reference in New Issue
Block a user