def setUp(self): """ Test initialization. """ self.coll = RegionalStackCollection(tenant_id='tenant123', region_name='XYZ') self.stack = Stack(stack_name='foo', collection=self.coll)
class HeatObjectTests(SynchronousTestCase): def setUp(self): """ Test initialization. """ self.coll = RegionalStackCollection(tenant_id='tenant123', region_name='XYZ') self.stack = Stack(stack_name='foo', collection=self.coll) def test_update_stack_action(self): """ Tests incorrect action update. """ self.assertRaises(ValueError, self.stack.update_action, 'foo') def test_update_stack_status(self): """ Tests incorrect status update. """ self.assertRaises(ValueError, self.stack.update_status, 'foo') def test_links_json(self): """ Test correctness of stack links. """ prefix = 'http://foo.bar/baz/' href = prefix + 'v1/%s/stacks/%s/%s' % ( self.coll.tenant_id, self.stack.stack_name, self.stack.stack_id) self.assertEqual(self.stack.links_json(lambda suffix: prefix + suffix), [{'href': href, 'rel': 'self'}])
class HeatObjectTests(SynchronousTestCase): def setUp(self): """ Test initialization. """ self.coll = RegionalStackCollection(tenant_id='tenant123', region_name='XYZ') self.stack = Stack(stack_name='foo', collection=self.coll) def test_update_stack_action(self): """ Tests incorrect action update. """ self.assertRaises(ValueError, self.stack.update_action, 'foo') def test_update_stack_status(self): """ Tests incorrect status update. """ self.assertRaises(ValueError, self.stack.update_status, 'foo') def test_links_json(self): """ Test correctness of stack links. """ prefix = 'http://foo.bar/baz/' href = prefix + 'v1/{}/stacks/{}/{}'.format( self.coll.tenant_id, self.stack.stack_name, self.stack.stack_id) self.assertEqual(self.stack.links_json(lambda suffix: prefix + suffix), [{ 'href': href, 'rel': 'self' }])