def test_hierachy_score_set_for_adding_child_with_relation_as_param(self): ''' Ensure that hierachy score is set when adding the child of a parent the relation is passed to the function ''' parent = Person(name='parent', gender='M', hierarchy_score = 100, family_id=self.family.id) parent.save() child = Person(name='child', gender='M', family_id=self.family.id) child.save() relation = Relation(from_person_id = parent.id, to_person_id = child.id, relation_type = RAISED) child.set_hierarchy_score(relation) self.assertEqual(101, child.hierarchy_score)
def test_hierachy_score_set_for_adding_child_with_relation_as_param(self): ''' Ensure that hierachy score is set when adding the child of a parent the relation is passed to the function ''' parent = Person(name='parent', gender='M', hierarchy_score = 100, family_id=self.family.id) parent.save() child = Person(name='child', gender='M', family_id=self.family.id) child.save() relation = Relation(from_person_id = parent.id, to_person_id = child.id, relation_type = RAISED) child.set_hierarchy_score(relation) self.assertEqual(101, child.hierarchy_score)
def test_hierachy_score_set_for_adding_partner(self): ''' Ensure that hierachy score is set when adding a partner ''' husband = Person(name='husband', gender='M', family_id=self.family.id) husband.save() wife = Person(name='wife', gender='F', hierarchy_score = 75, family_id=self.family.id) wife.save() relation = Relation(from_person_id = husband.id, to_person_id = wife.id, relation_type = PARTNERED) relation.save() husband.set_hierarchy_score() self.assertEqual(75, husband.hierarchy_score)
def test_hierachy_score_set_for_adding_partner(self): ''' Ensure that hierachy score is set when adding a partner ''' husband = Person(name='husband', gender='M', family_id=self.family.id) husband.save() wife = Person(name='wife', gender='F', hierarchy_score = 75, family_id=self.family.id) wife.save() relation = Relation(from_person_id = husband.id, to_person_id = wife.id, relation_type = PARTNERED) relation.save() husband.set_hierarchy_score() self.assertEqual(75, husband.hierarchy_score)
def test_hierachy_score_set_for_adding_parent(self): ''' Ensure that hierachy score is set when adding the parent of a child the relation is not passed to the function ''' parent = Person(name='parent', gender='M', family_id=self.family.id) parent.save() child = Person(name='child', gender='M', hierarchy_score = 100, family_id=self.family.id) child.save() relation = Relation(from_person_id = parent.id, to_person_id = child.id, relation_type = RAISED) relation.save() parent.set_hierarchy_score() self.assertEqual(99, parent.hierarchy_score)
def test_hierachy_score_set_for_adding_parent(self): ''' Ensure that hierachy score is set when adding the parent of a child the relation is not passed to the function ''' parent = Person(name='parent', gender='M', family_id=self.family.id) parent.save() child = Person(name='child', gender='M', hierarchy_score = 100, family_id=self.family.id) child.save() relation = Relation(from_person_id = parent.id, to_person_id = child.id, relation_type = RAISED) relation.save() parent.set_hierarchy_score() self.assertEqual(99, parent.hierarchy_score)