stream_users function has been renamed

This commit is contained in:
Mouse Reeve 2021-04-05 14:17:45 -07:00
parent 56330d448b
commit 6a3c01a67f

View file

@ -47,18 +47,18 @@ class Activitystreams(TestCase):
"{}-test-unread".format(self.local_user.id),
)
def test_abstractstream_stream_users(self, *_):
def test_abstractstream_get_audience(self, *_):
""" get a list of users that should see a status """
status = models.Status.objects.create(
user=self.remote_user, content="hi", privacy="public"
)
users = self.test_stream.stream_users(status)
users = self.test_stream.get_audience(status)
# remote users don't have feeds
self.assertFalse(self.remote_user in users)
self.assertTrue(self.local_user in users)
self.assertTrue(self.another_user in users)
def test_abstractstream_stream_users_direct(self, *_):
def test_abstractstream_get_audience_direct(self, *_):
""" get a list of users that should see a status """
status = models.Status.objects.create(
user=self.remote_user,
@ -66,7 +66,7 @@ class Activitystreams(TestCase):
privacy="direct",
)
status.mention_users.add(self.local_user)
users = self.test_stream.stream_users(status)
users = self.test_stream.get_audience(status)
self.assertEqual(users, [])
status = models.Comment.objects.create(
@ -76,22 +76,22 @@ class Activitystreams(TestCase):
book=self.book,
)
status.mention_users.add(self.local_user)
users = self.test_stream.stream_users(status)
users = self.test_stream.get_audience(status)
self.assertTrue(self.local_user in users)
self.assertFalse(self.another_user in users)
self.assertFalse(self.remote_user in users)
def test_abstractstream_stream_users_followers_remote_user(self, *_):
def test_abstractstream_get_audience_followers_remote_user(self, *_):
""" get a list of users that should see a status """
status = models.Status.objects.create(
user=self.remote_user,
content="hi",
privacy="followers",
)
users = self.test_stream.stream_users(status)
users = self.test_stream.get_audience(status)
self.assertFalse(users.exists())
def test_abstractstream_stream_users_followers_self(self, *_):
def test_abstractstream_get_audience_followers_self(self, *_):
""" get a list of users that should see a status """
status = models.Comment.objects.create(
user=self.local_user,
@ -99,12 +99,12 @@ class Activitystreams(TestCase):
privacy="direct",
book=self.book,
)
users = self.test_stream.stream_users(status)
users = self.test_stream.get_audience(status)
self.assertTrue(self.local_user in users)
self.assertFalse(self.another_user in users)
self.assertFalse(self.remote_user in users)
def test_abstractstream_stream_users_followers_with_mention(self, *_):
def test_abstractstream_get_audience_followers_with_mention(self, *_):
""" get a list of users that should see a status """
status = models.Comment.objects.create(
user=self.remote_user,
@ -114,12 +114,12 @@ class Activitystreams(TestCase):
)
status.mention_users.add(self.local_user)
users = self.test_stream.stream_users(status)
users = self.test_stream.get_audience(status)
self.assertTrue(self.local_user in users)
self.assertFalse(self.another_user in users)
self.assertFalse(self.remote_user in users)
def test_abstractstream_stream_users_followers_with_relationship(self, *_):
def test_abstractstream_get_audience_followers_with_relationship(self, *_):
""" get a list of users that should see a status """
self.remote_user.followers.add(self.local_user)
status = models.Comment.objects.create(
@ -128,77 +128,77 @@ class Activitystreams(TestCase):
privacy="direct",
book=self.book,
)
users = self.test_stream.stream_users(status)
users = self.test_stream.get_audience(status)
self.assertFalse(self.local_user in users)
self.assertFalse(self.another_user in users)
self.assertFalse(self.remote_user in users)
def test_homestream_stream_users(self, *_):
def test_homestream_get_audience(self, *_):
""" get a list of users that should see a status """
status = models.Status.objects.create(
user=self.remote_user, content="hi", privacy="public"
)
users = activitystreams.HomeStream().stream_users(status)
users = activitystreams.HomeStream().get_audience(status)
self.assertFalse(users.exists())
def test_homestream_stream_users_with_mentions(self, *_):
def test_homestream_get_audience_with_mentions(self, *_):
""" get a list of users that should see a status """
status = models.Status.objects.create(
user=self.remote_user, content="hi", privacy="public"
)
status.mention_users.add(self.local_user)
users = activitystreams.HomeStream().stream_users(status)
users = activitystreams.HomeStream().get_audience(status)
self.assertFalse(self.local_user in users)
self.assertFalse(self.another_user in users)
def test_homestream_stream_users_with_relationship(self, *_):
def test_homestream_get_audience_with_relationship(self, *_):
""" get a list of users that should see a status """
self.remote_user.followers.add(self.local_user)
status = models.Status.objects.create(
user=self.remote_user, content="hi", privacy="public"
)
users = activitystreams.HomeStream().stream_users(status)
users = activitystreams.HomeStream().get_audience(status)
self.assertTrue(self.local_user in users)
self.assertFalse(self.another_user in users)
def test_localstream_stream_users_remote_status(self, *_):
def test_localstream_get_audience_remote_status(self, *_):
""" get a list of users that should see a status """
status = models.Status.objects.create(
user=self.remote_user, content="hi", privacy="public"
)
users = activitystreams.LocalStream().stream_users(status)
users = activitystreams.LocalStream().get_audience(status)
self.assertEqual(users, [])
def test_localstream_stream_users_local_status(self, *_):
def test_localstream_get_audience_local_status(self, *_):
""" get a list of users that should see a status """
status = models.Status.objects.create(
user=self.local_user, content="hi", privacy="public"
)
users = activitystreams.LocalStream().stream_users(status)
users = activitystreams.LocalStream().get_audience(status)
self.assertTrue(self.local_user in users)
self.assertTrue(self.another_user in users)
def test_localstream_stream_users_unlisted(self, *_):
def test_localstream_get_audience_unlisted(self, *_):
""" get a list of users that should see a status """
status = models.Status.objects.create(
user=self.local_user, content="hi", privacy="unlisted"
)
users = activitystreams.LocalStream().stream_users(status)
users = activitystreams.LocalStream().get_audience(status)
self.assertEqual(users, [])
def test_federatedstream_stream_users(self, *_):
def test_federatedstream_get_audience(self, *_):
""" get a list of users that should see a status """
status = models.Status.objects.create(
user=self.remote_user, content="hi", privacy="public"
)
users = activitystreams.FederatedStream().stream_users(status)
users = activitystreams.FederatedStream().get_audience(status)
self.assertTrue(self.local_user in users)
self.assertTrue(self.another_user in users)
def test_federatedstream_stream_users_unlisted(self, *_):
def test_federatedstream_get_audience_unlisted(self, *_):
""" get a list of users that should see a status """
status = models.Status.objects.create(
user=self.remote_user, content="hi", privacy="unlisted"
)
users = activitystreams.FederatedStream().stream_users(status)
users = activitystreams.FederatedStream().get_audience(status)
self.assertEqual(users, [])