mirror of
https://github.com/bookwyrm-social/bookwyrm.git
synced 2024-12-24 17:10:31 +00:00
Fixes searching for users in group view, with test
This commit is contained in:
parent
fcd2a62e2a
commit
c7b2b303da
2 changed files with 14 additions and 2 deletions
|
@ -92,6 +92,18 @@ class GroupViews(TestCase):
|
||||||
validate_html(result.render())
|
validate_html(result.render())
|
||||||
self.assertEqual(result.status_code, 200)
|
self.assertEqual(result.status_code, 200)
|
||||||
|
|
||||||
|
def test_findusers_get_with_query(self, _):
|
||||||
|
"""there are so many views, this just makes sure it LOADS"""
|
||||||
|
view = views.FindUsers.as_view()
|
||||||
|
request = self.factory.get("", {"user_query": "rat"})
|
||||||
|
request.user = self.local_user
|
||||||
|
with patch("bookwyrm.suggested_users.SuggestedUsers.get_suggestions") as mock:
|
||||||
|
mock.return_value = models.User.objects.all()
|
||||||
|
result = view(request, group_id=self.testgroup.id)
|
||||||
|
self.assertIsInstance(result, TemplateResponse)
|
||||||
|
validate_html(result.render())
|
||||||
|
self.assertEqual(result.status_code, 200)
|
||||||
|
|
||||||
def test_group_create(self, _):
|
def test_group_create(self, _):
|
||||||
"""create group view"""
|
"""create group view"""
|
||||||
view = views.UserGroups.as_view()
|
view = views.UserGroups.as_view()
|
||||||
|
|
|
@ -151,8 +151,8 @@ class FindUsers(View):
|
||||||
no_results = not user_results
|
no_results = not user_results
|
||||||
|
|
||||||
if user_results.count() < 5:
|
if user_results.count() < 5:
|
||||||
user_results = list(user_results) + suggested_users.get_suggestions(
|
user_results = list(user_results) + list(
|
||||||
request.user, local=True
|
suggested_users.get_suggestions(request.user, local=True)
|
||||||
)
|
)
|
||||||
|
|
||||||
data = {
|
data = {
|
||||||
|
|
Loading…
Reference in a new issue