Exemplo n.º 1
0
 def setUp(self):
     super(TicketIndexerTestCase, self).setUp()
     self.whoosh_backend = WhooshBackend(self.env)
     self.whoosh_backend.recreate_index()
     self.ticket_indexer = TicketIndexer(self.env)
     self.search_api = BloodhoundSearchApi(self.env)
     self.env.config.set('bhsearch', 'silence_on_error', "False")
Exemplo n.º 2
0
    def test_can_index_ticket(self):
        ticket = self.create_dummy_ticket()
        TicketIndexer(self.env).resource_created(ticket, None)

        results = self.search_api.query("*:*")
        self.print_result(results)
        self.assertEqual(1, results.hits)
Exemplo n.º 3
0
 def _reindex_endpoints(self, relation):
     trs = TicketRelationsSpecifics(self.env)
     ticket_indexer = TicketIndexer(self.env)
     for resource in map(ResourceIdSerializer.get_resource_by_id,
                         (relation.source, relation.destination)):
         if resource.realm == 'ticket':
             ticket = trs._create_ticket_by_full_id(resource)
             ticket_indexer._index_ticket(ticket)
Exemplo n.º 4
0
 def _rename_milestone(self, milestone, old_name):
     try:
         doc = self.build_doc(milestone)
         search_api = BloodhoundSearchApi(self.env)
         with search_api.start_operation() as operation_context:
             search_api.change_doc_id(doc, old_name, operation_context)
             TicketIndexer(self.env).reindex_tickets(
                 search_api, operation_context, milestone=milestone.name)
     except Exception, e:
         if self.silence_on_error:
             self.log.error(
                 "Error occurs during renaming milestone from \
              %s to %s. The error will not be propagated. Exception: %s",
                 old_name, milestone.name, e)
         else:
             raise