Ejemplo n.º 1
0
 def test_derive_without_events(self):
     with TemporaryDirectory() as output_directory_path:
         configuration = Configuration(
             output_directory_path, 'https://example.com')
         configuration.plugins[Deriver] = {}
         site = Site(configuration)
         person = Person('P0')
         site.ancestry.people[person.id] = person
         parse(site)
         self.assertEquals(0, len(person.presences))
Ejemplo n.º 2
0
 def test_post_parse(self) -> None:
     with TemporaryDirectory() as output_directory_path:
         configuration = Configuration(output_directory_path,
                                       'https://example.com')
         configuration.plugins[Cleaner] = {}
         site = Site(configuration)
         event = IdentifiableEvent('E0', Event.Type.BIRTH)
         site.ancestry.events[event.id] = event
         parse(site)
         self.assertEquals({}, site.ancestry.events)
Ejemplo n.º 3
0
 def test_derive_with_events_without_dates(self):
     with TemporaryDirectory() as output_directory_path:
         configuration = Configuration(
             output_directory_path, 'https://example.com')
         configuration.plugins[Deriver] = {}
         site = Site(configuration)
         person = Person('P0')
         Presence(person, Presence.Role.SUBJECT, IdentifiableEvent('E0', Event.Type.MARRIAGE))
         site.ancestry.people[person.id] = person
         parse(site)
         self.assertEquals(1, len(person.presences))
Ejemplo n.º 4
0
 def test_post_parse(self):
     with TemporaryDirectory() as output_directory_path:
         configuration = Configuration(
             output_directory_path, 'https://example.com')
         configuration.plugins[Privatizer] = {}
         site = Site(configuration)
         person = Person('P0')
         Presence(person, Presence.Role.SUBJECT, IdentifiableEvent('E0', Event.Type.BIRTH))
         site.ancestry.people[person.id] = person
         parse(site)
         self.assertTrue(person.private)
Ejemplo n.º 5
0
 def test_post_parse(self) -> None:
     with TemporaryDirectory() as output_directory_path:
         configuration = Configuration(output_directory_path,
                                       'https://example.com')
         configuration.plugins[Anonymizer] = {}
         site = Site(configuration)
         person = Person('P0')
         person.private = True
         person.names.append(PersonName('Jane', 'Dough'))
         site.ancestry.people[person.id] = person
         parse(site)
         self.assertEquals(0, len(person.names))
Ejemplo n.º 6
0
 def test_post_parse(self):
     with TemporaryDirectory() as output_directory_path:
         configuration = Configuration(
             output_directory_path, 'https://example.com')
         configuration.plugins[Deriver] = {}
         site = Site(configuration)
         person = Person('P0')
         other_presence = Presence(person, Presence.Role.SUBJECT, IdentifiableEvent('E0', Event.Type.MARRIAGE))
         other_presence.event.date = Date(1970, 1, 1)
         site.ancestry.people[person.id] = person
         parse(site)
         self.assertEquals(3, len(person.presences))
         self.assertEquals(DateRange(None, Date(1970, 1, 1)), person.start.date)
         self.assertEquals(DateRange(Date(1970, 1, 1)), person.end.date)
Ejemplo n.º 7
0
 def test_parse_event(self):
     with TemporaryDirectory() as output_directory_path:
         configuration = Configuration(output_directory_path,
                                       'https://example.com')
         configuration.plugins[Gramps] = {
             'file':
             join(dirname(abspath(__file__)), 'resources', 'minimal.gpkg')
         }
         site = Site(configuration)
         parse(site)
         self.assertEquals('Dough',
                           site.ancestry.people['I0000'].name.affiliation)
         self.assertEquals('Janet',
                           site.ancestry.people['I0000'].name.individual)
         self.assertEquals('1px', site.ancestry.files['O0000'].description)
Ejemplo n.º 8
0
 def test_derive_birth_with_existing_event(self, other_date: Datey):
     with TemporaryDirectory() as output_directory_path:
         configuration = Configuration(
             output_directory_path, 'https://example.com')
         configuration.plugins[Deriver] = {}
         site = Site(configuration)
         person = Person('P0')
         other_presence = Presence(person, Presence.Role.SUBJECT, IdentifiableEvent('E0', Event.Type.MARRIAGE))
         other_presence.event.date = other_date
         irrelevant_presence = Presence(person, Presence.Role.SUBJECT, IdentifiableEvent('E1', Event.Type.DIVORCE))
         irrelevant_presence.event.date = Date(1972, 1, 1)
         site.ancestry.people[person.id] = person
         parse(site)
         self.assertEquals(4, len(person.presences))
         self.assertEquals(DateRange(None, Date(1971, 1, 1)), person.start.date)
Ejemplo n.º 9
0
 def test_derive_birth_with_existing_birth_with_date(self):
     with TemporaryDirectory() as output_directory_path:
         configuration = Configuration(
             output_directory_path, 'https://example.com')
         configuration.plugins[Deriver] = {}
         site = Site(configuration)
         person = Person('P0')
         birth_presence = Presence(person, Presence.Role.SUBJECT, IdentifiableEvent('E0', Event.Type.BIRTH))
         birth_presence.event.date = Date(1970, 2, 1)
         other_presence = Presence(person, Presence.Role.SUBJECT, IdentifiableEvent('E0', Event.Type.MARRIAGE))
         other_presence.event.date = Date(1970, 1, 1)
         site.ancestry.people[person.id] = person
         parse(site)
         self.assertEquals(3, len(person.presences))
         self.assertIsNotNone(birth_presence.event.date)
         self.assertEquals(Date(1970, 2, 1), birth_presence.event.date)
Ejemplo n.º 10
0
 def test_post_parse(self):
     with TemporaryDirectory() as output_directory_path:
         configuration = Configuration(output_directory_path,
                                       'https://example.com')
         configuration.plugins[Anonymizer] = {}
         site = Site(configuration)
         with NamedTemporaryFile() as file_f:
             person = Person('P0', 'Janet', 'Dough')
             person.private = True
             presence = Presence(Presence.Role.SUBJECT)
             presence.event = Event('E0', Event.Type.BIRTH)
             person.presences.add(presence)
             person.files.add(File('D0', file_f.name))
             site.ancestry.people[person.id] = person
             parse(site)
             self.assert_anonymized(person)
Ejemplo n.º 11
0
 def run(self):
     parse.parse(self._site)
     render.render(self._site)