Ejemplo n.º 1
0
def test_build_recid_to_uuid_map_numeric_pid_breaks_for_lit(isolated_app):
    pid1 = PersistentIdentifier.create(pid_type='lit', pid_value='abcdef',
                                       object_type='rec', object_uuid=uuid.uuid4())
    citations_lookup = {
        pid1.pid_value: 5,
    }
    with pytest.raises(ValueError):
        _build_recid_to_uuid_map(citations_lookup)
Ejemplo n.º 2
0
def test_build_recid_to_uuid_map_numeric_pid_breaks_for_lit(isolated_app):
    pid1 = PersistentIdentifier.create(pid_type='lit', pid_value='abcdef',
                                       object_type='rec', object_uuid=uuid.uuid4())
    citations_lookup = {
        pid1.pid_value: 5,
    }
    with pytest.raises(ValueError):
        _build_recid_to_uuid_map(citations_lookup)
Ejemplo n.º 3
0
def test_build_recid_to_uuid_map_ignored_types(isolated_app):
    citations_lookup = {}
    for type in ('urn', 'tex', 'cust'):
        pid = PersistentIdentifier.create(
            pid_type=type, pid_value='abcd', object_type='rec',
            object_uuid=uuid.uuid4())
        citations_lookup[pid.pid_value] = 6
    result = _build_recid_to_uuid_map(citations_lookup)
    assert result == {}
Ejemplo n.º 4
0
def test_build_recid_to_uuid_map_ignored_types(isolated_app):
    citations_lookup = {}
    for type in ('urn', 'tex', 'cust'):
        pid = PersistentIdentifier.create(
            pid_type=type, pid_value='abcd', object_type='rec',
            object_uuid=uuid.uuid4())
        citations_lookup[pid.pid_value] = 6
    result = _build_recid_to_uuid_map(citations_lookup)
    assert result == {}
Ejemplo n.º 5
0
def test_build_recid_to_uuid_map_numeric_pid_allowed_for_lit_and_con(isolated_app):
    pid1 = PersistentIdentifier.create(pid_type='lit', pid_value='123',
                                       object_type='rec', object_uuid=uuid.uuid4())
    pid2 = PersistentIdentifier.create(pid_type='con', pid_value='1234',
                                       object_type='rec', object_uuid=uuid.uuid4())
    citations_lookup = {
        pid1.pid_value: 5,
        pid2.pid_value: 6,
    }
    result = _build_recid_to_uuid_map(citations_lookup)
    assert result.keys().sort() == [pid1.object_uuid, pid2.object_uuid].sort()
Ejemplo n.º 6
0
def test_build_recid_to_uuid_map_numeric_pid_allowed_for_lit_and_con(isolated_app):
    pid1 = PersistentIdentifier.create(pid_type='lit', pid_value='123',
                                       object_type='rec', object_uuid=uuid.uuid4())
    pid2 = PersistentIdentifier.create(pid_type='con', pid_value='1234',
                                       object_type='rec', object_uuid=uuid.uuid4())
    citations_lookup = {
        pid1.pid_value: 5,
        pid2.pid_value: 6,
    }
    result = _build_recid_to_uuid_map(citations_lookup)
    assert result.keys().sort() == [pid1.object_uuid, pid2.object_uuid].sort()