Skip to content

Commit

Permalink
Add test for accented character search
Browse files Browse the repository at this point in the history
  • Loading branch information
jjnesbitt committed Jan 27, 2025
1 parent cab3dbb commit 989b793
Showing 1 changed file with 32 additions and 0 deletions.
32 changes: 32 additions & 0 deletions dandiapi/api/tests/test_dandiset.py
Original file line number Diff line number Diff line change
Expand Up @@ -1101,6 +1101,38 @@ def test_dandiset_rest_search_identifier(api_client, draft_version):
assert results[0]['draft_version']['name'] == draft_version.name


@pytest.mark.django_db
def test_dandiset_rest_search_accented_characters(api_client, draft_version_factory):
dv = draft_version_factory()
dv.metadata['contributor'][0]['name'] = 'Buzsáki, György'
dv.save()

assert (
api_client.get('/api/dandisets/', {'search': 'György'}).data['results']
== api_client.get('/api/dandisets/', {'search': 'Gyorgy'}).data['results']
)
assert (
api_client.get('/api/dandisets/', {'search': 'Buzsáki'}).data['results']
== api_client.get('/api/dandisets/', {'search': 'Buzsaki'}).data['results']
)


@pytest.mark.django_db
def test_dandiset_rest_search_many_versions(
api_client, draft_version_factory, published_version_factory, dandiset
):
draft_version = draft_version_factory(dandiset=dandiset)
draft_version.metadata['contributor'][0]['name'] = 'testname'
draft_version.save()

published_version = published_version_factory(dandiset=dandiset)
published_version.metadata['contributor'][0]['name'] = 'testname'
published_version.save()

results = api_client.get('/api/dandisets/', {'search': 'testname'}).data['results']
assert len(results) == 1


@pytest.mark.django_db
@pytest.mark.parametrize(
'contributors',
Expand Down

0 comments on commit 989b793

Please sign in to comment.