Apps and tags are suggested in global search.

This commit is contained in:
Roland 2023-11-20 11:29:14 -07:00
parent d042b06e8b
commit fdfb8797fe
No known key found for this signature in database
GPG key ID: 9D6DBD3ACF11AB93
7 changed files with 68 additions and 15 deletions

View file

@ -488,12 +488,13 @@ def test_search_str_estimate(test_session, test_client, test_directory, test_zim
@pytest.mark.asyncio
async def test_search_suggestions(test_session, test_async_client, channel_factory, archive_factory):
async def test_search_suggestions(test_session, test_async_client, channel_factory, archive_factory, tag_factory):
channel_factory(name='Foo')
channel_factory(name='Fool')
channel_factory(name='Bar')
archive_factory(domain='foo.com')
archive_factory(domain='bar.com')
tag_factory()
test_session.commit()
body = dict(search_str='foo')
@ -512,6 +513,13 @@ async def test_search_suggestions(test_session, test_async_client, channel_facto
assert response.json['channels'] == [{'directory': 'Bar', 'id': 3, 'name': 'Bar', 'url': 'https://example.com/Bar'}]
assert response.json['domains'] == [{'directory': 'archive/bar.com', 'domain': 'bar.com', 'id': 2}]
body = dict(search_str='one')
request, response = await test_async_client.post('/api/search_suggestions', json=body)
assert response.status_code == HTTPStatus.OK
assert response.json['channels'] == []
assert response.json['domains'] == []
assert response.json['tags'] == [{'color': '#111111', 'id': 1, 'name': 'one'}]
def test_recursive_errors():
"""Errors are reported recursively."""