examples/app.py
def records():
    """Load test data fixture."""
    import uuid
    from invenio_records.api import Record
    from invenio_pidstore.models import PersistentIdentifier, PIDStatus

    create_test_user()

    indexer = RecordIndexer()

    # Record 1 - Live record
    with db.session.begin_nested():
        rec_uuid = uuid.uuid4()
        pid1 = PersistentIdentifier.create(
            'recid', '1', object_type='rec', object_uuid=rec_uuid,
            status=PIDStatus.REGISTERED)
        Record.create({
            'title': 'Registered',
            'description': 'This is an awesome description',
            'control_number': '1',
            'access_right': 'restricted',
            'access_conditions': 'fuu',
            'owners': [1, 2],
            'recid': 1
        }, id_=rec_uuid)
        indexer.index_by_id(pid1.object_uuid)

    db.session.commit()

    sleep(3)
def records():
    """Load test data fixture."""
    import uuid
    from invenio_records.api import Record
    from invenio_pidstore.models import PersistentIdentifier, PIDStatus

    create_test_user()

    indexer = RecordIndexer()

    # Record 1 - Live record
    with db.session.begin_nested():
        rec_uuid = uuid.uuid4()
        pid1 = PersistentIdentifier.create(
            'recid', '1', object_type='rec', object_uuid=rec_uuid,
            status=PIDStatus.REGISTERED)
        Record.create({
            'title': 'Registered',
            'description': 'This is an awesome description',
            'control_number': '1',
            'access_right': 'restricted',
            'access_conditions': 'fuu',
            'owners': [1, 2],
            'recid': 1
        }, id_=rec_uuid)
        indexer.index_by_id(pid1.object_uuid)

    db.session.commit()

    sleep(3)
def records ( ) : import uuid from invenio_records . api import Record from invenio_pidstore . models import PersistentIdentifier , PIDStatus create_test_user ( ) indexer = RecordIndexer ( ) # Record 1 - Live record with db . session . begin_nested ( ) : rec_uuid = uuid . uuid4 ( ) pid1 = PersistentIdentifier . create ( 'recid' , '1' , object_type = 'rec' , object_uuid = rec_uuid , status = PIDStatus . REGISTERED ) Record . create ( { 'title' : 'Registered' , 'description' : 'This is an awesome description' , 'control_number' : '1' , 'access_right' : 'restricted' , 'access_conditions' : 'fuu' , 'owners' : [ 1 , 2 ] , 'recid' : 1 } , id_ = rec_uuid ) indexer . index_by_id ( pid1 . object_uuid ) db . session . commit ( ) sleep ( 3 )
Load test data fixture.
Load test data fixture .