diff --git a/bookwyrm/tests/test_suggested_users.py b/bookwyrm/tests/test_suggested_users.py index 0b37cd1a..af296624 100644 --- a/bookwyrm/tests/test_suggested_users.py +++ b/bookwyrm/tests/test_suggested_users.py @@ -15,12 +15,13 @@ class SuggestedUsers(TestCase): def setUp(self): """use a test csv""" - self.local_user = models.User.objects.create_user( - "mouse", "mouse@mouse.mouse", "password", local=True, localname="mouse" - ) + with patch("bookwyrm.suggested_users.rerank_suggestions_task.delay"): + self.local_user = models.User.objects.create_user( + "mouse", "mouse@mouse.mouse", "password", local=True, localname="mouse" + ) self.book = models.Edition.objects.create(title="test book") - def test_get_ramk(self, *_): + def test_get_rank(self, *_): """a float that reflects both the mutuals count and shared books""" Mock = namedtuple("AnnotatedUserMock", ("mutuals", "shared_books")) annotated_user_mock = Mock(3, 27) @@ -67,3 +68,12 @@ class SuggestedUsers(TestCase): match = results.first() self.assertEqual(match.id, suggestable_user.id) self.assertEqual(match.mutuals, 1) + + def test_create_user_signal(self, *_): + """build suggestions for new users""" + with patch("bookwyrm.suggested_users.rerank_suggestions_task.delay") as mock: + models.User.objects.create_user( + "nutria", "nutria@nu.tria", "password", local=True, localname="nutria" + ) + + self.assertEqual(mock.call_count, 1) diff --git a/bw-dev b/bw-dev index 0b583083..08bb5bc2 100755 --- a/bw-dev +++ b/bw-dev @@ -84,7 +84,7 @@ case "$CMD" in runweb coverage run --source='.' --omit="*/test*,celerywyrm*,bookwyrm/migrations/*" manage.py test "$@" ;; pytest) - runweb pytest --no-cov-on-fail "$@" + execweb pytest --no-cov-on-fail "$@" ;; collectstatic) runweb python manage.py collectstatic --no-input