Fix Stack instance delete method
The current instance delete method assumes that a Stack instance can be passed to the manager delete method, however the manager delete method only accepts a stack identifier. Change-Id: I87c30be1ea43695b7e13953531ea282fd8d386f8
This commit is contained in:
parent
18e110dbf0
commit
6f7239f67b
heatclient
@ -15,6 +15,7 @@
|
|||||||
|
|
||||||
from heatclient.v1.stacks import Stack
|
from heatclient.v1.stacks import Stack
|
||||||
|
|
||||||
|
from mock import MagicMock
|
||||||
import testscenarios
|
import testscenarios
|
||||||
from testscenarios.scenarios import multiply_scenarios
|
from testscenarios.scenarios import multiply_scenarios
|
||||||
import testtools
|
import testtools
|
||||||
@ -43,3 +44,12 @@ class StackStatusActionTest(testtools.TestCase):
|
|||||||
stack = Stack(None, {'stack_status': stack_status})
|
stack = Stack(None, {'stack_status': stack_status})
|
||||||
self.assertEqual(self.action, stack.action)
|
self.assertEqual(self.action, stack.action)
|
||||||
self.assertEqual(self.status, stack.status)
|
self.assertEqual(self.status, stack.status)
|
||||||
|
|
||||||
|
|
||||||
|
class StackOperationsTest(testtools.TestCase):
|
||||||
|
|
||||||
|
def test_delete_stack(self):
|
||||||
|
manager = MagicMock()
|
||||||
|
stack = Stack(manager, {'id': 'abcd1234'})
|
||||||
|
stack.delete()
|
||||||
|
manager.delete.assert_called_once_with('abcd1234')
|
||||||
|
@ -28,7 +28,7 @@ class Stack(base.Resource):
|
|||||||
self.manager.update(self, **fields)
|
self.manager.update(self, **fields)
|
||||||
|
|
||||||
def delete(self):
|
def delete(self):
|
||||||
return self.manager.delete(self)
|
return self.manager.delete(self.id)
|
||||||
|
|
||||||
def data(self, **kwargs):
|
def data(self, **kwargs):
|
||||||
return self.manager.data(self, **kwargs)
|
return self.manager.data(self, **kwargs)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user