def setup(): check_solr() global _old_sp config = apps.get_app_config("haystack") _old_sp = config.signal_processor config.signal_processor = RealtimeSignalProcessor( haystack.connections, haystack.connection_router)
def test_hook_called(self, mock_delete, mock_save, mock_es): # check if the signals are triggered rsp = RealtimeSignalProcessor(haystack.connections, haystack.connection_router) # noqa self.assertFalse(mock_delete.called) self.assertFalse(mock_save.called) documents = create_documents() doc = documents[0] doc.save() self.assertTrue(mock_save.called) doc.object.delete() self.assertTrue(mock_delete.called)
def handle_delete(self,*args,**kwargs): RealtimeSignalProcessor.handle_save(self, *args,**kwargs)
def setup(): check_solr() global _old_sp _old_sp = haystack.signal_processor haystack.signal_processor = RealtimeSignalProcessor( haystack.connections, haystack.connection_router)