Returning the json body after a stack-create or stack-update
This allows the downstream service access to the data coming back from the REST API, primarily the stack id. implements blueprint return-id-on-stack-create Change-Id: I24db9c28fca1f50f5ef1452679f444095d22d103
This commit is contained in:
@@ -12,7 +12,6 @@
|
||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
from heatclient.v1.stacks import Stack
|
||||
from heatclient.v1.stacks import StackManager
|
||||
|
||||
@@ -90,6 +89,12 @@ class StackOperationsTest(testtools.TestCase):
|
||||
stack.update()
|
||||
manager.update.assert_called_once_with('the_stack/abcd1234')
|
||||
|
||||
def test_create_stack(self):
|
||||
manager = MagicMock()
|
||||
stack = mock_stack(manager, 'the_stack', 'abcd1234')
|
||||
stack = stack.create()
|
||||
manager.create.assert_called_once_with('the_stack/abcd1234')
|
||||
|
||||
|
||||
class StackManagerNoPaginationTest(testtools.TestCase):
|
||||
|
||||
|
||||
@@ -22,6 +22,9 @@ class Stack(base.Resource):
|
||||
def __repr__(self):
|
||||
return "<Stack %s>" % self._info
|
||||
|
||||
def create(self, **fields):
|
||||
return self.manager.create(self.identifier, **fields)
|
||||
|
||||
def update(self, **fields):
|
||||
self.manager.update(self.identifier, **fields)
|
||||
|
||||
@@ -109,6 +112,7 @@ class StackManager(base.Manager):
|
||||
headers = self.api.credentials_headers()
|
||||
resp, body = self.api.json_request('POST', '/stacks',
|
||||
body=kwargs, headers=headers)
|
||||
return body
|
||||
|
||||
def update(self, stack_id, **kwargs):
|
||||
"""Update a stack."""
|
||||
|
||||
Reference in New Issue
Block a user