def index_deposit_after_publish(sender, action=None, pid=None, deposit=None): """Index the record after publishing. .. note:: if the record is not published, it doesn't index. :param sender: Who send the signal. :param action: Action executed by the sender. (Default: ``None``) :param pid: PID object. (Default: ``None``) :param deposit: Deposit object. (Default: ``None``) """ if action == 'publish': _, record = deposit.fetch_published() index_record.delay(str(record.id))
def index_deposit_after_publish(sender, action=None, pid=None, deposit=None): """Index the record after publishing.""" if action == 'publish': _, record = deposit.fetch_published() index_record.delay(str(record.id))
def _index_deposit(deposit): """Index deposit if set.""" if deposit: index_record.delay(str(deposit.id))
def test_index_record(app): """Test index records.""" with patch('invenio_indexer.api.RecordIndexer.index_by_id') as fun: recid = str(uuid.uuid4()) index_record.delay(recid) fun.assert_called_with(recid)