diff --git a/gramps2/src/plugins/TestcaseGenerator.py b/gramps2/src/plugins/TestcaseGenerator.py index 7b331716f..42efed776 100644 --- a/gramps2/src/plugins/TestcaseGenerator.py +++ b/gramps2/src/plugins/TestcaseGenerator.py @@ -375,7 +375,7 @@ class TestcaseGenerator(Tool.Tool): fam = RelLib.Family() fam.set_father_handle(person1_h) fam.set_mother_handle(person2_h) - fam.set_relationship((RelLib.Family.MARRIED,'')) + fam.set_relationship((RelLib.FamilyRelType.MARRIED,'')) fam_h = self.db.add_family(fam,self.trans) #person1 = self.db.get_person_from_handle(person1_h) #person1.add_family_handle(fam_h) @@ -391,7 +391,7 @@ class TestcaseGenerator(Tool.Tool): fam = RelLib.Family() #fam.set_father_handle(person1_h) fam.set_mother_handle(person2_h) - fam.set_relationship((RelLib.Family.MARRIED,'')) + fam.set_relationship((RelLib.FamilyRelType.MARRIED,'')) fam_h = self.db.add_family(fam,self.trans) person1 = self.db.get_person_from_handle(person1_h) person1.add_family_handle(fam_h) @@ -407,7 +407,7 @@ class TestcaseGenerator(Tool.Tool): fam = RelLib.Family() fam.set_father_handle(person1_h) #fam.set_mother_handle(person2_h) - fam.set_relationship((RelLib.Family.MARRIED,'')) + fam.set_relationship((RelLib.FamilyRelType.MARRIED,'')) fam_h = self.db.add_family(fam,self.trans) person1 = self.db.get_person_from_handle(person1_h) person1.add_family_handle(fam_h) @@ -423,7 +423,7 @@ class TestcaseGenerator(Tool.Tool): fam = RelLib.Family() fam.set_father_handle(person1_h) fam.set_mother_handle(person2_h) - fam.set_relationship((RelLib.Family.MARRIED,'')) + fam.set_relationship((RelLib.FamilyRelType.MARRIED,'')) fam_h = self.db.add_family(fam,self.trans) person1 = self.db.get_person_from_handle(person1_h) person1.add_family_handle(fam_h) @@ -439,7 +439,7 @@ class TestcaseGenerator(Tool.Tool): fam = RelLib.Family() fam.set_father_handle(person1_h) fam.set_mother_handle(person2_h) - fam.set_relationship((RelLib.Family.MARRIED,'')) + fam.set_relationship((RelLib.FamilyRelType.MARRIED,'')) fam_h = self.db.add_family(fam,self.trans) person1 = self.db.get_person_from_handle(person1_h) person1.add_family_handle(fam_h) @@ -455,7 +455,7 @@ class TestcaseGenerator(Tool.Tool): fam = RelLib.Family() fam.set_father_handle("InvalidHandle1") fam.set_mother_handle(person2_h) - fam.set_relationship((RelLib.Family.MARRIED,'')) + fam.set_relationship((RelLib.FamilyRelType.MARRIED,'')) fam_h = self.db.add_family(fam,self.trans) #person1 = self.db.get_person_from_handle(person1_h) #person1.add_family_handle(fam_h) @@ -471,7 +471,7 @@ class TestcaseGenerator(Tool.Tool): fam = RelLib.Family() fam.set_father_handle(person1_h) fam.set_mother_handle("InvalidHandle2") - fam.set_relationship((RelLib.Family.MARRIED,'')) + fam.set_relationship((RelLib.FamilyRelType.MARRIED,'')) fam_h = self.db.add_family(fam,self.trans) person1 = self.db.get_person_from_handle(person1_h) person1.add_family_handle(fam_h) @@ -489,8 +489,11 @@ class TestcaseGenerator(Tool.Tool): fam = RelLib.Family() fam.set_father_handle(person1_h) fam.set_mother_handle(person2_h) - fam.set_relationship((RelLib.Family.MARRIED,'')) - fam.add_child_handle(child_h) + fam.set_relationship((RelLib.FamilyRelType.MARRIED,'')) + child_ref = RelLib.ChildRef() + child_ref.set_reference_handle(child_h) + self.fill_object(child_ref) + fam.add_child_ref(child_ref) fam_h = self.db.add_family(fam,self.trans) person1 = self.db.get_person_from_handle(person1_h) person1.add_family_handle(fam_h) @@ -510,8 +513,12 @@ class TestcaseGenerator(Tool.Tool): fam = RelLib.Family() fam.set_father_handle(person1_h) fam.set_mother_handle(person2_h) - fam.set_relationship((RelLib.Family.MARRIED,'')) + fam.set_relationship((RelLib.FamilyRelType.MARRIED,'')) #fam.add_child_handle(child_h) + child_ref = RelLib.ChildRef() + child_ref.set_reference_handle(child_h) + self.fill_object(child_ref) + fam.add_child_ref(child_ref) fam_h = self.db.add_family(fam,self.trans) person1 = self.db.get_person_from_handle(person1_h) person1.add_family_handle(fam_h) @@ -520,7 +527,7 @@ class TestcaseGenerator(Tool.Tool): person2.add_family_handle(fam_h) self.db.commit_person(person2,self.trans) child = self.db.get_person_from_handle(child_h) - child.add_parent_family_handle(fam_h,RelLib.ChildRefType(),RelLib.ChildRefType()) + child.add_parent_family_handle(fam_h) self.db.commit_person(child,self.trans) self.commit_transaction() # COMMIT TRANSACTION STEP @@ -554,6 +561,7 @@ class TestcaseGenerator(Tool.Tool): # Creates a person with a birth event having an empty type person_h = self.generate_person(None,"Broken14",None) event = RelLib.Event() + event.set_type('') event.set_description("Test for Broken14") event_h = self.db.add_event(event,self.trans) event_ref = RelLib.EventRef() @@ -590,24 +598,28 @@ class TestcaseGenerator(Tool.Tool): # Creates a person with a birth event pointing to nonexisting place person_h = self.generate_person(None,"Broken17",None) event = RelLib.Event() - event.set_name("Birth") + event.set_type(RelLib.EventType.BIRTH) event.set_place_handle("InvalidHandle7") event.set_description("Test for Broken17") event_h = self.db.add_event(event,self.trans) + event_ref = RelLib.EventRef() + event_ref.set_reference_handle(event_h) person = self.db.get_person_from_handle(person_h) - person.set_birth_handle(event_h) + person.set_birth_ref(event_ref) self.db.commit_person(person,self.trans) self.commit_transaction() # COMMIT TRANSACTION STEP # Creates a person with an event pointing to nonexisting place person_h = self.generate_person(None,"Broken18",None) event = RelLib.Event() - event.set_name("Birth") + event.set_type(RelLib.EventType.BIRTH) event.set_place_handle("InvalidHandle8") event.set_description("Test for Broken18") event_h = self.db.add_event(event,self.trans) + event_ref = RelLib.EventRef() + event_ref.set_reference_handle(event_h) person = self.db.get_person_from_handle(person_h) - person.add_event_handle(event_h) + person.add_event_ref(event_ref) self.db.commit_person(person,self.trans) self.commit_transaction() # COMMIT TRANSACTION STEP