def test_remote(self): """Test the remote property""" ent1 = BaseEntity('father') self.assertTrue(ent1.remote) ent1.remote = False ent2 = BaseEntity('child') ent2.inherits_from(ent1) self.assertFalse(ent2.remote)
def test_tags(self): """Test tags property""" ent1 = BaseEntity(name='parent') self.assertEqual(ent1.tags, set()) ent1.tags.add('foo') ent2 = BaseEntity(name='child') ent2.inherits_from(ent1) self.assertEqual(ent2.tags, set(['foo'])) ent2.tags = set(['bar']) self.assertEqual(ent2.tags, set(['bar']))
def test_inheritance_of_non_existing_target(self): ''' Test inheritance between entities with non-existing target/description ''' ent1 = BaseEntity(name='parent') ent1.desc = "foo" ent2 = BaseEntity(name='child', target="@none") ent2.desc = "" ent2.inherits_from(ent1) self.assertEqual(ent2.target, NodeSet()) self.assertEqual(ent2.desc, "")
def test_inheritance_of_properties1(self): '''Test inheritance between entities''' ent1 = BaseEntity(name='parent', target='aury[10-16]') ent1.fanout = 5 ent1.errors = 2 ent1.timeout = 15 ent2 = BaseEntity(name='child') ent2.inherits_from(ent1) self.assertEqual(ent2.target, NodeSet('aury[10-16]')) self.assertEqual(ent2.fanout, 5) self.assertEqual(ent2.errors, 2) self.assertEqual(ent2.timeout, 15)
def inherits_from(self, entity): '''Inherit properties from entity''' BaseEntity.inherits_from(self, entity) for action in self.iter_actions(): action.inherits_from(self)
def inherits_from(self, entity): '''Inherit properties from entity''' BaseEntity.inherits_from(self, entity) for subservice in self.iter_subservices(): subservice.inherits_from(self)
def inherits_from(self, entity): """Inherit properties from entity""" BaseEntity.inherits_from(self, entity) for action in self.iter_actions(): action.inherits_from(self)