Ejemplo n.º 1
0
def test_listing_collections_search():
    client = ArchivesSpaceClient(**AUTH)
    collections = client.find_collections(search_pattern='Test fonds')
    assert len(collections) == 1
    assert collections[0]['title'] == 'Test fonds'
    assert collections[0]['type'] == 'resource'

    no_results = client.find_collections(search_pattern='No such fonds')
    assert len(no_results) == 0
def test_listing_collections_search():
    client = ArchivesSpaceClient(**AUTH)
    collections = client.find_collections(search_pattern='Test fonds')
    assert len(collections) == 1
    assert collections[0]['title'] == 'Test fonds'
    assert collections[0]['type'] == 'resource'

    no_results = client.find_collections(search_pattern='No such fonds')
    assert len(no_results) == 0
Ejemplo n.º 3
0
def test_identifier_search_wildcard():
    client = ArchivesSpaceClient(**AUTH)
    # Searching for an identifier prefix with no wildcard returns nothing
    assert client.find_collection_ids(identifier='F') == []
    assert client.count_collections(identifier='F') == 0
    assert len(client.find_collections(identifier='F')) == 0

    assert client.find_collection_ids(identifier='F*') == ['/repositories/2/resources/1', '/repositories/2/resources/2']
    assert client.count_collections(identifier='F*') == 2
    assert len(client.find_collections(identifier='F*')) == 2
def test_identifier_search_wildcard():
    client = ArchivesSpaceClient(**AUTH)
    # Searching for an identifier prefix with no wildcard returns nothing
    assert client.find_collection_ids(identifier='F') == []
    assert client.count_collections(identifier='F') == 0
    assert len(client.find_collections(identifier='F')) == 0

    assert client.find_collection_ids(identifier='F*') == ['/repositories/2/resources/1', '/repositories/2/resources/2']
    assert client.count_collections(identifier='F*') == 2
    assert len(client.find_collections(identifier='F*')) == 2
def test_listing_collections_sort():
    client = ArchivesSpaceClient(**AUTH)
    asc = client.find_collections(sort_by='asc')
    assert len(asc) == 2
    assert asc[0]['title'] == 'Some other fonds'
    assert asc[0]['type'] == 'resource'

    desc = client.find_collections(sort_by='desc')
    assert len(desc) == 2
    assert desc[0]['title'] == 'Test fonds'
    assert desc[0]['type'] == 'resource'
Ejemplo n.º 6
0
def test_listing_collections_sort():
    client = ArchivesSpaceClient(**AUTH)
    asc = client.find_collections(sort_by='asc')
    assert len(asc) == 2
    assert asc[0]['title'] == 'Some other fonds'
    assert asc[0]['type'] == 'resource'

    desc = client.find_collections(sort_by='desc')
    assert len(desc) == 2
    assert desc[0]['title'] == 'Test fonds'
    assert desc[0]['type'] == 'resource'
Ejemplo n.º 7
0
def test_empty_dates():
    client = ArchivesSpaceClient(**AUTH)
    record = client.get_resource_component_children('/repositories/2/archival_objects/2')
    assert record['dates'] == ''
    assert record['date_expression'] == ''
    record = client.get_resource_component_and_children('/repositories/2/resources/2',
                                                        recurse_max_level=1)
    # dates are mandatory for resources, so this record does have a date but no expression
    assert record['date_expression'] == ''
    collections = client.find_collections()
    assert collections[0]['date_expression'] == ''
def test_empty_dates():
    client = ArchivesSpaceClient(**AUTH)
    record = client.get_resource_component_children('/repositories/2/archival_objects/2')
    assert record['dates'] == ''
    assert record['date_expression'] == ''
    record = client.get_resource_component_and_children('/repositories/2/resources/2',
                                                        recurse_max_level=1)
    # dates are mandatory for resources, so this record does have a date but no expression
    assert record['date_expression'] == ''
    collections = client.find_collections()
    assert collections[0]['date_expression'] == ''
Ejemplo n.º 9
0
def test_contentless_notes():
    client = ArchivesSpaceClient(**AUTH)
    collections = client.find_collections()
    assert collections[-1]['notes'][0]['type'] == 'bioghist'
    assert collections[-1]['notes'][0]['content'] == ''
Ejemplo n.º 10
0
def test_rendering_record_containing_a_singlepart_note():
    client = ArchivesSpaceClient(**AUTH)
    collections = client.find_collections()
    assert len(collections) == 2
    assert collections[1]['notes'][0]['content'] == 'Singlepart note'
Ejemplo n.º 11
0
def test_listing_collections():
    client = ArchivesSpaceClient(**AUTH)
    collections = client.find_collections()
    assert len(collections) == 2
    assert collections[0]['title'] == 'Test fonds'
    assert collections[0]['type'] == 'resource'
def test_listing_collections_search_spaces():
    client = ArchivesSpaceClient(**AUTH)
    collections = client.find_collections(identifier="2015044 Aa Ac")
    assert len(collections) == 1
    assert collections[0]['title'] == 'Resource with spaces in the identifier'
    assert collections[0]['levelOfDescription'] == 'collection'
def test_rendering_record_containing_a_singlepart_note():
    client = ArchivesSpaceClient(**AUTH)
    collections = client.find_collections()
    assert len(collections) == 2
    assert collections[1]['notes'][0]['content'] == 'Singlepart note'
def test_identifier_search_exact_match():
    client = ArchivesSpaceClient(**AUTH)
    assert client.find_collection_ids(identifier='F1') == ['/repositories/2/resources/1']
    assert client.count_collections(identifier='F1') == 1
    assert len(client.find_collections(identifier='F1')) == 1
def test_listing_collections():
    client = ArchivesSpaceClient(**AUTH)
    collections = client.find_collections()
    assert len(collections) == 2
    assert collections[0]['title'] == 'Test fonds'
    assert collections[0]['type'] == 'resource'
Ejemplo n.º 16
0
def test_listing_collections_search_spaces():
    client = ArchivesSpaceClient(**AUTH)
    collections = client.find_collections(identifier="2015044 Aa Ac")
    assert len(collections) == 1
    assert collections[0]['title'] == 'Resource with spaces in the identifier'
    assert collections[0]['levelOfDescription'] == 'collection'
Ejemplo n.º 17
0
def test_identifier_search_exact_match():
    client = ArchivesSpaceClient(**AUTH)
    assert client.find_collection_ids(identifier='F1') == ['/repositories/2/resources/1']
    assert client.count_collections(identifier='F1') == 1
    assert len(client.find_collections(identifier='F1')) == 1
def test_contentless_notes():
    client = ArchivesSpaceClient(**AUTH)
    collections = client.find_collections()
    assert collections[-1]['notes'][0]['type'] == 'bioghist'
    assert collections[-1]['notes'][0]['content'] == ''