Remove another private OSC attribute usage

tripleoclient WebsocketClient used a private auth attribute. This
switches it to a more public api.

Change-Id: Ib6a3ad21b9d770dad943b6e567cfbea8402cc84f
Closes-Bug: #1605876
This commit is contained in:
Brad P. Crochet 2016-07-28 12:02:40 -04:00 committed by John Trowbridge
parent defa3f3dbd
commit 4f10fe4080
2 changed files with 3 additions and 8 deletions

View File

@ -21,7 +21,6 @@ import uuid
import websocket
from openstackclient.common import utils
from openstackclient.identity import common as identity_common
LOG = logging.getLogger(__name__)
@ -74,9 +73,7 @@ class WebsocketClient(object):
'messaging')
token = instance.auth.get_token(instance.session)
self._project_id = identity_common.find_project(
instance.identity,
instance._project_name).id
self._project_id = instance.auth_ref.project_id
self._websocket_client_id = str(uuid.uuid4())

View File

@ -25,11 +25,10 @@ class TestPlugin(base.TestCase):
@mock.patch("websocket.create_connection")
def test_make_client(self, ws_create_connection):
clientmgr = mock.MagicMock()
clientmgr._api_version.__getitem__.return_value = '1'
clientmgr.get_endpoint_for_service_type.return_value = fakes.AUTH_URL
clientmgr.auth.get_token.return_value = "TOKEN"
clientmgr.identity.projects.get.return_value = mock.MagicMock(id="ID")
clientmgr.auth_ref.project_id = "ID"
ws_create_connection.return_value.recv.return_value = json.dumps({
"headers": {
"status": 200
@ -71,10 +70,9 @@ class TestPlugin(base.TestCase):
}, send_ack]
clientmgr = mock.MagicMock()
clientmgr._api_version.__getitem__.return_value = '1'
clientmgr.get_endpoint_for_service_type.return_value = fakes.AUTH_URL
clientmgr.auth.get_token.return_value = "TOKEN"
clientmgr.identity.projects.get.return_value = mock.MagicMock(id="ID")
clientmgr.auth_ref.project_id = "ID"
client = plugin.make_client(clientmgr)