Adds test for search with no query

This commit is contained in:
Mouse Reeve 2021-05-20 16:32:44 -07:00
parent b6c17defd7
commit ab3fb4d555

View file

@ -53,6 +53,18 @@ class Views(TestCase):
self.assertEqual(data[0]["title"], "Test Book") self.assertEqual(data[0]["title"], "Test Book")
self.assertEqual(data[0]["key"], "https://%s/book/%d" % (DOMAIN, self.book.id)) self.assertEqual(data[0]["key"], "https://%s/book/%d" % (DOMAIN, self.book.id))
def test_search_no_query(self):
"""just the search page"""
view = views.Search.as_view()
# we need a connector for this, sorry
request = self.factory.get("")
with patch("bookwyrm.views.search.is_api_request") as is_api:
is_api.return_value = False
response = view(request)
self.assertIsInstance(response, TemplateResponse)
response.render()
def test_search_books(self): def test_search_books(self):
"""searches remote connectors""" """searches remote connectors"""
view = views.Search.as_view() view = views.Search.as_view()