def test_privatize_without_relatives(self, expected, private, event: Optional[Event]): person = Person('P0') person.private = private if event is not None: Presence(person, Presence.Role.SUBJECT, event) ancestry = Ancestry() ancestry.people[person.id] = person sut = Privatizer() sut.privatize(ancestry) self.assertEquals(expected, person.private)
def test_privatize_without_relatives(self, expected, private, event: Optional[Event]): person = Person('P0', 'Janet', 'Dough') person.private = private if event is not None: presence = Presence(Presence.Role.SUBJECT) presence.event = event person.presences.add(presence) ancestry = Ancestry() ancestry.people[person.id] = person sut = Privatizer() sut.privatize(ancestry) self.assertEquals(expected, person.private)
def test_privatize_with_parent(self, expected, private, event: Optional[Event]): person = Person('P0') person.private = private parent = Person('P1') if event is not None: Presence(parent, Presence.Role.SUBJECT, event) person.parents.append(parent) ancestry = Ancestry() ancestry.people[person.id] = person ancestry.people[parent.id] = parent sut = Privatizer() sut.privatize(ancestry) self.assertEquals(expected, person.private)
def test_privatize_with_child(self, expected, private, event: Optional[Event]): person = Person('P0') person.private = private child = Person('P1') if event is not None: Presence(child, Presence.Role.SUBJECT, event) person.children.append(child) ancestry = Ancestry() ancestry.people[person.id] = person ancestry.people[child.id] = child sut = Privatizer() sut.privatize(ancestry) self.assertEquals(expected, person.private)
def test_privatize_with_child(self, expected, private, event: Optional[Event]): person = Person('P0', 'Janet', 'Dough') person.private = private child = Person('P1') if event is not None: presence = Presence(Presence.Role.SUBJECT) presence.event = event child.presences.add(presence) person.children.add(child) ancestry = Ancestry() ancestry.people[person.id] = person ancestry.people[child.id] = child sut = Privatizer() sut.privatize(ancestry) self.assertEquals(expected, person.private)
def test_privatize_with_great_grandparent(self, expected, private, event: Optional[Event]): person = Person('P0', 'Janet', 'Dough') person.private = private parent = Person('P1') person.parents.add(parent) grandparent = Person('P2') parent.parents.add(grandparent) great_grandparent = Person('P2') if event is not None: presence = Presence(Presence.Role.SUBJECT) presence.event = event great_grandparent.presences.add(presence) grandparent.parents.add(great_grandparent) ancestry = Ancestry() ancestry.people[person.id] = person sut = Privatizer() sut.privatize(ancestry) self.assertEquals(expected, person.private)