Beispiel #1
0
def test_link_signature_to_author_with_curated_signature_but_no_ref(
        inspire_app):
    data = {
        "authors": [{
            "full_name": "Doe, John",
            "uuid": "94fc2b0a-dc17-42c2-bae3-ca0024079e51",
            "curated_relation": True,
        }]
    }
    record = create_record("lit", data=data)
    signature_data = {
        "publication_id": record["control_number"],
        "signature_uuid": "94fc2b0a-dc17-42c2-bae3-ca0024079e51",
    }
    signature = link_signature_to_author(signature_data, 123)
    expected_signatures = [{
        "full_name": "Doe, John",
        "uuid": "94fc2b0a-dc17-42c2-bae3-ca0024079e51",
        "signature_block": "Dj",
        "record": {
            "$ref": "http://localhost:5000/api/authors/123"
        },
        "curated_relation": False,
    }]
    assert expected_signatures[0] == signature
    assert expected_signatures == record["authors"]
Beispiel #2
0
def test_link_signature_to_author_with_curated_signature_and_ref(inspire_app):
    data = {
        "authors": [{
            "full_name": "Doe, John",
            "uuid": "94fc2b0a-dc17-42c2-bae3-ca0024079e51",
            "curated_relation": True,
            "record": {
                "$ref": "http://localhost:5000/api/authors/42"
            },
        }]
    }
    record = create_record("lit", data=data)
    signature_data = {
        "publication_id": record["control_number"],
        "signature_uuid": "94fc2b0a-dc17-42c2-bae3-ca0024079e51",
    }
    signature = link_signature_to_author(signature_data, 123)
    assert signature is None
Beispiel #3
0
def test_link_signature_to_author_with_no_change(base_app, db, es_clear,
                                                 create_record, redis):
    data = {
        "authors": [{
            "full_name": "Doe, John",
            "uuid": "94fc2b0a-dc17-42c2-bae3-ca0024079e51",
            "signature_block": "Dj",
            "record": {
                "$ref": "http://localhost:5000/api/authors/123"
            },
        }]
    }
    record = create_record("lit", data=data)
    signature_data = {
        "publication_id": record["control_number"],
        "signature_uuid": "94fc2b0a-dc17-42c2-bae3-ca0024079e51",
    }
    signature = link_signature_to_author(signature_data, 123)
    assert signature is None
Beispiel #4
0
def test_link_signature_to_author_missing_uuid(inspire_app):
    data = {
        "authors": [{
            "full_name": "Doe, John",
            "uuid": "94fc2b0a-dc17-42c2-bae3-ca0024079e54"
        }]
    }
    record = create_record("lit", data=data)
    signature_data = {
        "publication_id": record["control_number"],
        "signature_uuid": "94fc2b0a-dc17-42c2-bae3-ca0024079e51",
    }
    signature = link_signature_to_author(signature_data, 123)
    expected_signatures = [{
        "full_name": "Doe, John",
        "uuid": "94fc2b0a-dc17-42c2-bae3-ca0024079e54",
        "signature_block": "Dj",
    }]
    assert signature is None
    assert expected_signatures == record["authors"]