create_service() should normalize return value
The new service data being returned from create_service() was not going through the normalization function. Change-Id: I5e80e7a74f71a61d83653595b9a176d2aa9039ec
This commit is contained in:
parent
661927392c
commit
9035ade760
@ -0,0 +1,3 @@
|
||||
---
|
||||
fixes:
|
||||
- The returned data from a create_service() call was not being normalized.
|
@ -779,7 +779,7 @@ class OperatorCloud(openstackcloud.OpenStackCloud):
|
||||
service = self.manager.submitTask(_tasks.ServiceCreate(
|
||||
name=name, description=description, **service_kwargs))
|
||||
|
||||
return service
|
||||
return _utils.normalize_keystone_services([service])[0]
|
||||
|
||||
def list_services(self):
|
||||
"""List all Keystone services.
|
||||
|
@ -21,6 +21,7 @@ Tests Keystone services commands.
|
||||
|
||||
from mock import patch
|
||||
import os_client_config
|
||||
from shade import _utils
|
||||
from shade import OpenStackCloudException
|
||||
from shade import OperatorCloud
|
||||
from shade.tests.fakes import FakeService
|
||||
@ -47,8 +48,9 @@ class CloudServices(base.TestCase):
|
||||
self.mock_ks_services = [FakeService(**kwa) for kwa in
|
||||
self.mock_services]
|
||||
|
||||
@patch.object(_utils, 'normalize_keystone_services')
|
||||
@patch.object(OperatorCloud, 'keystone_client')
|
||||
def test_create_service(self, mock_keystone_client):
|
||||
def test_create_service(self, mock_keystone_client, mock_norm):
|
||||
kwargs = {
|
||||
'name': 'a service',
|
||||
'type': 'network',
|
||||
@ -58,15 +60,14 @@ class CloudServices(base.TestCase):
|
||||
self.client.create_service(**kwargs)
|
||||
kwargs['service_type'] = kwargs.pop('type')
|
||||
mock_keystone_client.services.create.assert_called_with(**kwargs)
|
||||
self.assertTrue(mock_norm.called)
|
||||
|
||||
@patch.object(OperatorCloud, 'keystone_client')
|
||||
def test_list_services(self, mock_keystone_client):
|
||||
mock_keystone_client.services.list.return_value = \
|
||||
self.mock_ks_services
|
||||
|
||||
services = self.client.list_services()
|
||||
mock_keystone_client.services.list.assert_called_with()
|
||||
|
||||
self.assertItemsEqual(self.mock_services, services)
|
||||
|
||||
@patch.object(OperatorCloud, 'keystone_client')
|
||||
|
Loading…
Reference in New Issue
Block a user