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' no_results = client.find_collections(search_pattern='No such fonds') assert len(no_results) == 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' desc = client.find_collections(sort_by='desc') assert len(desc) == 2 assert desc[0]['title'] == 'Test fonds'
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_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) == 1 assert collections[0]['title'] == 'Test fonds'