mirror of
https://github.com/bookwyrm-social/bookwyrm.git
synced 2025-04-23 10:44:06 +00:00
Adds redis mocks to base model tests
This commit is contained in:
parent
c8812c48c1
commit
8f3601d4cd
1 changed files with 3 additions and 0 deletions
|
@ -57,6 +57,7 @@ class BaseModel(TestCase):
|
||||||
base_model.set_remote_id(None, instance, False)
|
base_model.set_remote_id(None, instance, False)
|
||||||
self.assertIsNone(instance.remote_id)
|
self.assertIsNone(instance.remote_id)
|
||||||
|
|
||||||
|
@patch("bookwyrm.activitystreams.ActivityStream.add_status")
|
||||||
def test_object_visible_to_user(self, _):
|
def test_object_visible_to_user(self, _):
|
||||||
""" does a user have permission to view an object """
|
""" does a user have permission to view an object """
|
||||||
obj = models.Status.objects.create(
|
obj = models.Status.objects.create(
|
||||||
|
@ -85,6 +86,7 @@ class BaseModel(TestCase):
|
||||||
obj.mention_users.add(self.local_user)
|
obj.mention_users.add(self.local_user)
|
||||||
self.assertTrue(obj.visible_to_user(self.local_user))
|
self.assertTrue(obj.visible_to_user(self.local_user))
|
||||||
|
|
||||||
|
@patch("bookwyrm.activitystreams.ActivityStream.add_status")
|
||||||
def test_object_visible_to_user_follower(self, _):
|
def test_object_visible_to_user_follower(self, _):
|
||||||
""" what you can see if you follow a user """
|
""" what you can see if you follow a user """
|
||||||
self.remote_user.followers.add(self.local_user)
|
self.remote_user.followers.add(self.local_user)
|
||||||
|
@ -104,6 +106,7 @@ class BaseModel(TestCase):
|
||||||
obj.mention_users.add(self.local_user)
|
obj.mention_users.add(self.local_user)
|
||||||
self.assertTrue(obj.visible_to_user(self.local_user))
|
self.assertTrue(obj.visible_to_user(self.local_user))
|
||||||
|
|
||||||
|
@patch("bookwyrm.activitystreams.ActivityStream.add_status")
|
||||||
def test_object_visible_to_user_blocked(self, _):
|
def test_object_visible_to_user_blocked(self, _):
|
||||||
""" you can't see it if they block you """
|
""" you can't see it if they block you """
|
||||||
self.remote_user.blocks.add(self.local_user)
|
self.remote_user.blocks.add(self.local_user)
|
||||||
|
|
Loading…
Reference in a new issue