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:
Steve Baker 2013-08-05 08:55:52 +12:00
parent 18e110dbf0
commit 6f7239f67b
2 changed files with 11 additions and 1 deletions

View File

@ -15,6 +15,7 @@
from heatclient.v1.stacks import Stack
from mock import MagicMock
import testscenarios
from testscenarios.scenarios import multiply_scenarios
import testtools
@ -43,3 +44,12 @@ class StackStatusActionTest(testtools.TestCase):
stack = Stack(None, {'stack_status': stack_status})
self.assertEqual(self.action, stack.action)
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')

View File

@ -28,7 +28,7 @@ class Stack(base.Resource):
self.manager.update(self, **fields)
def delete(self):
return self.manager.delete(self)
return self.manager.delete(self.id)
def data(self, **kwargs):
return self.manager.data(self, **kwargs)