mirror of
https://github.com/bookwyrm-social/bookwyrm.git
synced 2024-11-15 21:31:26 +00:00
adjust Group test mocks
This commit is contained in:
parent
9116af1b3f
commit
ca47f836d1
2 changed files with 27 additions and 33 deletions
|
@ -69,22 +69,6 @@ class Group(TestCase):
|
|||
privacy="followers",
|
||||
)
|
||||
|
||||
self.followers_list = models.List.objects.create(
|
||||
name="Followers List",
|
||||
curation="group",
|
||||
privacy="followers",
|
||||
group=self.public_group,
|
||||
user=self.owner_user,
|
||||
)
|
||||
|
||||
self.private_list = models.List.objects.create(
|
||||
name="Private List",
|
||||
privacy="direct",
|
||||
curation="group",
|
||||
group=self.public_group,
|
||||
user=self.owner_user,
|
||||
)
|
||||
|
||||
models.GroupMember.objects.create(group=self.private_group, user=self.badger)
|
||||
models.GroupMember.objects.create(
|
||||
group=self.followers_only_group, user=self.badger
|
||||
|
@ -112,21 +96,40 @@ class Group(TestCase):
|
|||
def test_group_members_can_see_followers_only_lists(self, _):
|
||||
"""follower-only group booklists should not be excluded from group booklist listing for group members who do not follower list owner"""
|
||||
|
||||
with patch("bookwyrm.models.activitypub_mixin.broadcast_task.delay"):
|
||||
followers_list = models.List.objects.create(
|
||||
name="Followers List",
|
||||
curation="group",
|
||||
privacy="followers",
|
||||
group=self.public_group,
|
||||
user=self.owner_user,
|
||||
)
|
||||
|
||||
rat_lists = models.List.privacy_filter(self.rat).all()
|
||||
badger_lists = models.List.privacy_filter(self.badger).all()
|
||||
capybara_lists = models.List.privacy_filter(self.capybara).all()
|
||||
|
||||
self.assertFalse(self.followers_list in rat_lists)
|
||||
self.assertFalse(self.followers_list in badger_lists)
|
||||
self.assertTrue(self.followers_list in capybara_lists)
|
||||
self.assertFalse(followers_list in rat_lists)
|
||||
self.assertFalse(followers_list in badger_lists)
|
||||
self.assertTrue(followers_list in capybara_lists)
|
||||
|
||||
def test_group_members_can_see_private_lists(self, _):
|
||||
"""private group booklists should not be excluded from group booklist listing for group members"""
|
||||
|
||||
with patch("bookwyrm.models.activitypub_mixin.broadcast_task.delay"):
|
||||
|
||||
private_list = models.List.objects.create(
|
||||
name="Private List",
|
||||
privacy="direct",
|
||||
curation="group",
|
||||
group=self.public_group,
|
||||
user=self.owner_user,
|
||||
)
|
||||
|
||||
rat_lists = models.List.privacy_filter(self.rat).all()
|
||||
badger_lists = models.List.privacy_filter(self.badger).all()
|
||||
capybara_lists = models.List.privacy_filter(self.capybara).all()
|
||||
|
||||
self.assertFalse(self.private_list in rat_lists)
|
||||
self.assertFalse(self.private_list in badger_lists)
|
||||
self.assertTrue(self.private_list in capybara_lists)
|
||||
self.assertFalse(private_list in rat_lists)
|
||||
self.assertFalse(private_list in badger_lists)
|
||||
self.assertTrue(private_list in capybara_lists)
|
||||
|
|
|
@ -27,16 +27,6 @@ class GroupViews(TestCase):
|
|||
local=True,
|
||||
localname="mouse",
|
||||
)
|
||||
with patch("bookwyrm.models.user.set_remote_server.delay"):
|
||||
self.remote_user = models.User.objects.create_user(
|
||||
"rat",
|
||||
"rat@rat.com",
|
||||
"ratword",
|
||||
local=False,
|
||||
remote_id="https://example.com/users/rat",
|
||||
inbox="https://example.com/users/rat/inbox",
|
||||
outbox="https://example.com/users/rat/outbox",
|
||||
)
|
||||
|
||||
self.testgroup = models.Group.objects.create(
|
||||
name="Test Group",
|
||||
|
@ -70,7 +60,8 @@ class GroupViews(TestCase):
|
|||
validate_html(result.render())
|
||||
self.assertEqual(result.status_code, 200)
|
||||
|
||||
def test_findusers_get(self, _):
|
||||
@patch("bookwyrm.suggested_users.SuggestedUsers.get_suggestions")
|
||||
def test_findusers_get(self, *_):
|
||||
"""there are so many views, this just makes sure it LOADS"""
|
||||
view = views.FindUsers.as_view()
|
||||
request = self.factory.get("")
|
||||
|
|
Loading…
Reference in a new issue