Пример #1
0
def test_isbns_from_record():
    rec = {'title': 'test', 'isbn_13': ['9780190906764'], 'isbn_10': ['0190906766']}
    result = isbns_from_record(rec)
    assert isinstance(result, list)
    assert '9780190906764' in result
    assert '0190906766' in result
    assert len(result) == 2
Пример #2
0
def test_editions_matched_no_results(mock_site):
    rec = {
        'title': 'test',
        'isbn_13': ['9780190906764'],
        'isbn_10': ['0190906766']
    }
    isbns = isbns_from_record(rec)
    result = editions_matched(rec, 'isbn_', isbns)
    # returns no results because there are no existing editions
    assert result == []
Пример #3
0
def test_editions_matched(mock_site, add_languages, ia_writeback):
    rec = {'title': 'test', 'isbn_13': ['9780190906764'], 'isbn_10': ['0190906766'], 'source_records': ['test:001']}
    load(rec)
    isbns = isbns_from_record(rec)

    result_10 = editions_matched(rec, 'isbn_10', '0190906766')
    assert result_10 == ['/books/OL1M']

    result_13 = editions_matched(rec, 'isbn_13', '9780190906764')
    assert result_13 == ['/books/OL1M']

    # searching on key isbn_ will return a matching record on either isbn_10 or isbn_13 metadata fields
    result = editions_matched(rec, 'isbn_', isbns)
    assert result == ['/books/OL1M']