template.Template(tmpl2))
# patch in a dummy handle_update
- self.m.StubOutWithMock(generic_rsrc.GenericResource, 'handle_update')
+ self.m.StubOutWithMock(generic_rsrc.ResourceWithProps, 'handle_update')
tmpl_diff = {'Properties': {'Foo': 'xyz'}}
prop_diff = {'Foo': 'xyz'}
- generic_rsrc.GenericResource.handle_update(
+ generic_rsrc.ResourceWithProps.handle_update(
tmpl2['Resources']['AResource'], tmpl_diff,
prop_diff).AndRaise(Exception("Foo"))
self.m.ReplayAll()
# key/property in update_allowed_keys/update_allowed_properties
# make the update fail deleting the existing resource
- self.m.StubOutWithMock(generic_rsrc.GenericResource, 'handle_delete')
- generic_rsrc.GenericResource.handle_delete().AndRaise(Exception)
+ self.m.StubOutWithMock(generic_rsrc.ResourceWithProps, 'handle_delete')
+ generic_rsrc.ResourceWithProps.handle_delete().AndRaise(Exception)
self.m.ReplayAll()
self.stack.update(updated_stack)
# key/property in update_allowed_keys/update_allowed_properties
# patch in a dummy handle_create making the replace fail creating
- self.m.StubOutWithMock(generic_rsrc.GenericResource, 'handle_create')
- generic_rsrc.GenericResource.handle_create().AndRaise(Exception)
+ self.m.StubOutWithMock(generic_rsrc.ResourceWithProps, 'handle_create')
+ generic_rsrc.ResourceWithProps.handle_create().AndRaise(Exception)
self.m.ReplayAll()
self.stack.update(updated_stack)
# patch in a dummy handle_create making the replace fail when creating
# the replacement rsrc, but succeed the second call (rollback)
- self.m.StubOutWithMock(generic_rsrc.GenericResource, 'handle_create')
- generic_rsrc.GenericResource.handle_create().AndRaise(Exception)
- generic_rsrc.GenericResource.handle_create().AndReturn(None)
+ self.m.StubOutWithMock(generic_rsrc.ResourceWithProps, 'handle_create')
+ generic_rsrc.ResourceWithProps.handle_create().AndRaise(Exception)
+ generic_rsrc.ResourceWithProps.handle_create().AndReturn(None)
self.m.ReplayAll()
self.stack.update(updated_stack)
# patch in a dummy handle_create making the replace fail when creating
# the replacement rsrc, and again on the second call (rollback)
- self.m.StubOutWithMock(generic_rsrc.GenericResource, 'handle_create')
- generic_rsrc.GenericResource.handle_create().AndRaise(Exception)
- generic_rsrc.GenericResource.handle_create().AndRaise(Exception)
+ self.m.StubOutWithMock(generic_rsrc.ResourceWithProps, 'handle_create')
+ generic_rsrc.ResourceWithProps.handle_create().AndRaise(Exception)
+ generic_rsrc.ResourceWithProps.handle_create().AndRaise(Exception)
self.m.ReplayAll()
self.stack.update(updated_stack)
# resource.UpdateReplace because we've not specified the modified
# key/property in update_allowed_keys/update_allowed_properties
- self.m.StubOutWithMock(generic_rsrc.GenericResource, 'FnGetRefId')
- generic_rsrc.GenericResource.FnGetRefId().AndReturn(
+ self.m.StubOutWithMock(generic_rsrc.ResourceWithProps, 'FnGetRefId')
+ generic_rsrc.ResourceWithProps.FnGetRefId().AndReturn(
'AResource')
- generic_rsrc.GenericResource.FnGetRefId().MultipleTimes().AndReturn(
+ generic_rsrc.ResourceWithProps.FnGetRefId().MultipleTimes().AndReturn(
'inst-007')
self.m.ReplayAll()
self.assertEqual(self.stack['BResource'].properties['Foo'],
'AResource')
- self.m.StubOutWithMock(generic_rsrc.GenericResource, 'FnGetRefId')
- self.m.StubOutWithMock(generic_rsrc.GenericResource, 'handle_create')
+ self.m.StubOutWithMock(generic_rsrc.ResourceWithProps, 'FnGetRefId')
+ self.m.StubOutWithMock(generic_rsrc.ResourceWithProps, 'handle_create')
- # Calls to GenericResource.handle_update will raise
+ # Calls to ResourceWithProps.handle_update will raise
# resource.UpdateReplace because we've not specified the modified
# key/property in update_allowed_keys/update_allowed_properties
- generic_rsrc.GenericResource.FnGetRefId().AndReturn(
+ generic_rsrc.ResourceWithProps.FnGetRefId().AndReturn(
'AResource')
# mock to make the replace fail when creating the replacement resource
- generic_rsrc.GenericResource.handle_create().AndRaise(Exception)
+ generic_rsrc.ResourceWithProps.handle_create().AndRaise(Exception)
- generic_rsrc.GenericResource.handle_create().AndReturn(None)
- generic_rsrc.GenericResource.FnGetRefId().MultipleTimes().AndReturn(
+ generic_rsrc.ResourceWithProps.handle_create().AndReturn(None)
+ generic_rsrc.ResourceWithProps.FnGetRefId().MultipleTimes().AndReturn(
'AResource')
self.m.ReplayAll()
self.assertEqual(self.stack['BResource'].properties['Foo'],
'AResource1')
- self.m.StubOutWithMock(generic_rsrc.GenericResource, 'handle_create')
+ self.m.StubOutWithMock(generic_rsrc.ResourceWithProps, 'handle_create')
- # Calls to GenericResource.handle_update will raise
+ # Calls to ResourceWithProps.handle_update will raise
# resource.UpdateReplace because we've not specified the modified
# key/property in update_allowed_keys/update_allowed_properties
# mock to make the replace fail when creating the second
# replacement resource
- generic_rsrc.GenericResource.handle_create().AndRaise(Exception)
+ generic_rsrc.ResourceWithProps.handle_create().AndRaise(Exception)
- # Calls to GenericResource.handle_update will raise
+ # Calls to ResourceWithProps.handle_update will raise
# resource.UpdateReplace because we've not specified the modified
# key/property in update_allowed_keys/update_allowed_properties
- generic_rsrc.GenericResource.handle_create().AndReturn(None)
+ generic_rsrc.ResourceWithProps.handle_create().AndReturn(None)
self.m.ReplayAll()
utmpl = {'Type': 'GenericResourceType', 'Properties': {'Foo': 'xyz'}}
tmpl_diff = {'Properties': {'Foo': 'xyz'}}
prop_diff = {'Foo': 'xyz'}
- self.m.StubOutWithMock(generic_rsrc.GenericResource, 'handle_update')
- generic_rsrc.GenericResource.handle_update(
+ self.m.StubOutWithMock(generic_rsrc.ResourceWithProps, 'handle_update')
+ generic_rsrc.ResourceWithProps.handle_update(
utmpl, tmpl_diff, prop_diff).AndReturn(None)
self.m.ReplayAll()
self.assertEqual((res.CREATE, res.COMPLETE), res.state)
utmpl = {'Type': 'GenericResourceType', 'Properties': {'Foo': 'xyz'}}
- self.m.StubOutWithMock(generic_rsrc.GenericResource, 'handle_update')
+ self.m.StubOutWithMock(generic_rsrc.ResourceWithProps, 'handle_update')
tmpl_diff = {'Properties': {'Foo': 'xyz'}}
prop_diff = {'Foo': 'xyz'}
- generic_rsrc.GenericResource.handle_update(
+ generic_rsrc.ResourceWithProps.handle_update(
utmpl, tmpl_diff, prop_diff).AndRaise(resource.UpdateReplace())
self.m.ReplayAll()
# should be re-raised so parser.Stack can handle replacement
utmpl = {'Type': 'GenericResourceType', 'Properties': {'Foo': 'xyz'}}
tmpl_diff = {'Properties': {'Foo': 'xyz'}}
prop_diff = {'Foo': 'xyz'}
- self.m.StubOutWithMock(generic_rsrc.GenericResource, 'handle_update')
- generic_rsrc.GenericResource.handle_update(utmpl, tmpl_diff, prop_diff
- ).AndRaise(NotImplemented)
+ self.m.StubOutWithMock(generic_rsrc.ResourceWithProps, 'handle_update')
+ generic_rsrc.ResourceWithProps.handle_update(
+ utmpl, tmpl_diff, prop_diff).AndRaise(NotImplemented)
self.m.ReplayAll()
self.assertRaises(exception.ResourceFailure, res.update, utmpl)
self.assertEqual((res.UPDATE, res.FAILED), res.state)
scheduler.TaskRunner(res.create)()
self.assertEqual((res.CREATE, res.COMPLETE), res.state)
- self.m.StubOutWithMock(generic_rsrc.GenericResource, 'handle_suspend')
- generic_rsrc.GenericResource.handle_suspend().AndRaise(Exception())
+ self.m.StubOutWithMock(generic_rsrc.ResourceWithProps,
+ 'handle_suspend')
+ generic_rsrc.ResourceWithProps.handle_suspend().AndRaise(Exception())
self.m.ReplayAll()
suspend = scheduler.TaskRunner(res.suspend)
scheduler.TaskRunner(res.create)()
self.assertEqual((res.CREATE, res.COMPLETE), res.state)
- self.m.StubOutWithMock(generic_rsrc.GenericResource, 'handle_resume')
- generic_rsrc.GenericResource.handle_resume().AndRaise(Exception())
+ self.m.StubOutWithMock(generic_rsrc.ResourceWithProps, 'handle_resume')
+ generic_rsrc.ResourceWithProps.handle_resume().AndRaise(Exception())
self.m.ReplayAll()
res.state_set(res.SUSPEND, res.COMPLETE)