Removed dead code

This commit is contained in:
Eliot Berriot 2018-12-06 10:14:04 +01:00
parent 752a06c20a
commit 24b8ca7227
No known key found for this signature in database
GPG Key ID: DD6965E2476E5C27
2 changed files with 2 additions and 33 deletions

View File

@ -386,15 +386,3 @@ def get_actors_from_audience(urls):
if not final_query:
return models.Actor.objects.none()
return models.Actor.objects.filter(final_query)
def get_inbox_urls(actor_queryset):
"""
Given an actor queryset, returns a deduplicated set containing
all inbox or shared inbox urls where we should deliver our payloads for
those actors
"""
values = actor_queryset.values("inbox_url", "shared_inbox_url")
urls = set([actor["shared_inbox_url"] or actor["inbox_url"] for actor in values])
return sorted(urls)

View File

@ -78,22 +78,6 @@ def test_get_actors_from_audience_urls(settings, db):
assert str(activity.get_actors_from_audience(urls).query) == str(expected.query)
def test_get_inbox_urls(factories):
a1 = factories["federation.Actor"](
shared_inbox_url=None, inbox_url="https://a1.inbox"
)
a2 = factories["federation.Actor"](
shared_inbox_url="https://shared.inbox", inbox_url="https://a2.inbox"
)
factories["federation.Actor"](
shared_inbox_url="https://shared.inbox", inbox_url="https://a3.inbox"
)
expected = sorted(set([a1.inbox_url, a2.shared_inbox_url]))
assert activity.get_inbox_urls(a1.__class__.objects.all()) == expected
def test_receive_invalid_data(factories):
remote_actor = factories["federation.Actor"]()
a = {"@context": [], "actor": remote_actor.fid, "id": "https://test.activity"}
@ -212,9 +196,6 @@ def test_outbox_router_dispatch(mocker, factories, now):
"actor": actor,
}
expected_deliveries_url = activity.get_inbox_urls(
models.Actor.objects.filter(pk__in=[r1.pk, r2.pk])
)
router.connect({"type": "Noop"}, handler)
activities = router.dispatch({"type": "Noop"}, {"summary": "hello"})
a = activities[0]
@ -235,8 +216,8 @@ def test_outbox_router_dispatch(mocker, factories, now):
assert a.uuid is not None
assert a.deliveries.count() == 2
for url in expected_deliveries_url:
delivery = a.deliveries.get(inbox_url=url)
for actor in [r1, r2]:
delivery = a.deliveries.get(inbox_url=actor.inbox_url)
assert delivery.is_delivered is False