def test_get_value_missing_index(self):
        doc = {'indices': []}
        doc2 = {}

        item = CaseIndexItem(
            path=[PathNode(name='indices'),
                  PathNode(name='RegCase')])
        col = CaseIndexExportColumn(item=item)

        self.assertEqual(col.get_value('domain', 'docid', doc, []), '')
        self.assertEqual(col.get_value('domain', 'docid', doc2, []), '')
示例#2
0
 def test_get_value(self):
     doc = {
         'indices': [
             {
                 'referenced_id': 'abc',
                 'referenced_type': 'RegCase',
             },
             {
                 'referenced_id': 'def',
                 'referenced_type': 'RegCase',
             },
             {
                 'referenced_id': 'notme',
                 'referenced_type': 'OtherCase',
             },
         ]
     }
     item = CaseIndexItem(path=[PathNode(name='indices'), PathNode(name='RegCase')])
     col = CaseIndexExportColumn(item=item)
     self.assertEqual(col.get_value('domain', 'docid', doc, []), 'abc def')