forked from mirrors/bookwyrm
Fixes interaction tests
This commit is contained in:
parent
52adfbf5da
commit
ef71da7ef0
2 changed files with 14 additions and 5 deletions
|
@ -83,7 +83,10 @@ class InteractionViews(TestCase):
|
||||||
with patch("bookwyrm.activitystreams.ActivityStream.add_status"):
|
with patch("bookwyrm.activitystreams.ActivityStream.add_status"):
|
||||||
status = models.Status.objects.create(user=self.local_user, content="hi")
|
status = models.Status.objects.create(user=self.local_user, content="hi")
|
||||||
|
|
||||||
view(request, status.id)
|
with patch(
|
||||||
|
"bookwyrm.activitystreams.ActivityStream.remove_object_from_related_stores"
|
||||||
|
):
|
||||||
|
view(request, status.id)
|
||||||
|
|
||||||
boost = models.Boost.objects.get()
|
boost = models.Boost.objects.get()
|
||||||
|
|
||||||
|
@ -157,8 +160,11 @@ class InteractionViews(TestCase):
|
||||||
with patch("bookwyrm.activitystreams.ActivityStream.add_status"):
|
with patch("bookwyrm.activitystreams.ActivityStream.add_status"):
|
||||||
status = models.Status.objects.create(user=self.local_user, content="hi")
|
status = models.Status.objects.create(user=self.local_user, content="hi")
|
||||||
|
|
||||||
view(request, status.id)
|
with patch(
|
||||||
view(request, status.id)
|
"bookwyrm.activitystreams.ActivityStream.remove_object_from_related_stores"
|
||||||
|
):
|
||||||
|
view(request, status.id)
|
||||||
|
view(request, status.id)
|
||||||
self.assertEqual(models.Boost.objects.count(), 1)
|
self.assertEqual(models.Boost.objects.count(), 1)
|
||||||
|
|
||||||
def test_unboost(self, _):
|
def test_unboost(self, _):
|
||||||
|
@ -168,7 +174,10 @@ class InteractionViews(TestCase):
|
||||||
request.user = self.remote_user
|
request.user = self.remote_user
|
||||||
with patch("bookwyrm.activitystreams.ActivityStream.add_status"):
|
with patch("bookwyrm.activitystreams.ActivityStream.add_status"):
|
||||||
status = models.Status.objects.create(user=self.local_user, content="hi")
|
status = models.Status.objects.create(user=self.local_user, content="hi")
|
||||||
views.Boost.as_view()(request, status.id)
|
with patch(
|
||||||
|
"bookwyrm.activitystreams.ActivityStream.remove_object_from_related_stores"
|
||||||
|
):
|
||||||
|
views.Boost.as_view()(request, status.id)
|
||||||
|
|
||||||
self.assertEqual(models.Boost.objects.count(), 1)
|
self.assertEqual(models.Boost.objects.count(), 1)
|
||||||
self.assertEqual(models.Notification.objects.count(), 1)
|
self.assertEqual(models.Notification.objects.count(), 1)
|
||||||
|
|
2
bw-dev
2
bw-dev
|
@ -84,7 +84,7 @@ case "$CMD" in
|
||||||
runweb coverage run --source='.' --omit="*/test*,celerywyrm*,bookwyrm/migrations/*" manage.py test "$@"
|
runweb coverage run --source='.' --omit="*/test*,celerywyrm*,bookwyrm/migrations/*" manage.py test "$@"
|
||||||
;;
|
;;
|
||||||
pytest)
|
pytest)
|
||||||
runweb pytest --no-cov-on-fail "$@"
|
execweb pytest --no-cov-on-fail "$@"
|
||||||
;;
|
;;
|
||||||
collectstatic)
|
collectstatic)
|
||||||
runweb python manage.py collectstatic --no-input
|
runweb python manage.py collectstatic --no-input
|
||||||
|
|
Loading…
Reference in a new issue