def test_find_property_by_name(self): # Setup r = heat.Resource('i', 't') r.add_property(heat.ResourceProperty('a', 'a1')) r.add_property(heat.ResourceProperty('b', 'b1')) # Test found = r.find_property_by_name('b') # Verify self.assertTrue(found is not None) self.assertEqual(found.value, 'b1')
def test_init(self): # Test p = heat.ResourceProperty('test-name', 'test-value') str(p) # should not error # Verify self.assertEqual('test-name', p.name) self.assertEqual('test-value', p.value)
def test_add_remove_property(self): r = heat.Resource('i', 't') p = heat.ResourceProperty('n', 'v') # Test Add r.add_property(p) self.assertEqual(1, len(r.properties)) self.assertEqual(p, r.properties[0]) # Test Remove r.remove_property(p) self.assertEqual(0, len(r.properties))
def test_remove_property_not_found(self): r = heat.Resource('i', 't') self.assertRaises(ValueError, r.remove_property, heat.ResourceProperty('n', 'v'))