Esempio n. 1
0
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))
Esempio n. 2
0
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))
Esempio n. 3
0
def _index_deposit(deposit):
    """Index deposit if set."""
    if deposit:
        index_record.delay(str(deposit.id))
Esempio n. 4
0
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)
Esempio n. 5
0
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)
Esempio n. 6
0
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))