Ejemplo n.º 1
0
    def test_exists(self):
        test_values = [
            ('person_1', 'surname', False),
            ('person_2', 'surname', True),
            ('person_3', 'surname', True),
            ('unknow_person', 'surname', False),
        ]

        for id_, field, result in test_values:
            target = MongoCellTarget(self.mongo_client, INDEX, COLLECTION, id_, field)
            self.assertEqual(result, target.exists())
Ejemplo n.º 2
0
    def test_exists_nested(self):
        test_values = [
            ('person_1', 'infos', True),
            ('person_1', 'infos.family', True),
            ('person_2', 'family', False),
            ('person_4', 'infos', True),
            ('person_4', 'infos.family', True),
            ('person_4', 'infos.sexe', False),
            ('person_4', 'infos.family.children', True),
            ('person_4', 'infos.family.aunt', False),
        ]

        for id_, path, result in test_values:
            target = MongoCellTarget(self.mongo_client, INDEX, COLLECTION, id_, path)
            self.assertEqual(result, target.exists())