Permalink
Browse files

Raise 404 when searching in nonexisting article

  • Loading branch information...
duvholt committed Nov 22, 2017
1 parent ccf9c85 commit 5ab06029cbb4ad7ca4de2512fbf6f415fb952f25
Showing with 10 additions and 1 deletion.
  1. +1 −1 src/wiki/views/article.py
  2. +9 −0 tests/core/test_views.py
@@ -693,7 +693,7 @@ def get_queryset(self):
include_self=True).values_list('article_id')
articles = articles.filter(id__in=article_ids)
except (NoRootURL, models.URLPath.DoesNotExist):
pass
raise Http404
articles = articles.filter(
Q(current_revision__title__icontains=self.query) |
Q(current_revision__content__icontains=self.query))
View
@@ -459,6 +459,15 @@ def contains_title(articles, title):
self.assertFalse(contains_title(articles, 'Test1'))
self.assertTrue(contains_title(articles, 'Subtest0'))
def test_hierarchy_search_404(self):
c = self.client
response = c.get(resolve_url(
'wiki:search', path='test0/'), {'q': 'Content test'})
self.assertEqual(response.status_code, 404)
class DeletedListViewTest(RequireRootArticleMixin, ArticleWebTestUtils, DjangoClientTestBase):

0 comments on commit 5ab0602

Please sign in to comment.