mirror of
https://code.eliotberriot.com/funkwhale/funkwhale.git
synced 2025-10-04 22:09:23 +02:00
Do not deliver anything to remote instances when federation is disabled
This commit is contained in:
parent
6572db3a83
commit
b028f3f817
2 changed files with 26 additions and 1 deletions
|
@ -87,6 +87,20 @@ def test_dispatch_outbox(factories, mocker):
|
|||
mocked_deliver_to_remote.assert_called_once_with(delivery_id=delivery.pk)
|
||||
|
||||
|
||||
def test_dispatch_outbox_disabled_federation(factories, mocker, preferences):
|
||||
preferences["federation__enabled"] = False
|
||||
mocked_inbox = mocker.patch("funkwhale_api.federation.tasks.dispatch_inbox.delay")
|
||||
mocked_deliver_to_remote = mocker.patch(
|
||||
"funkwhale_api.federation.tasks.deliver_to_remote.delay"
|
||||
)
|
||||
activity = factories["federation.Activity"](actor__local=True)
|
||||
factories["federation.InboxItem"](activity=activity)
|
||||
factories["federation.Delivery"](activity=activity)
|
||||
tasks.dispatch_outbox(activity_id=activity.pk)
|
||||
mocked_inbox.assert_called_once_with(activity_id=activity.pk)
|
||||
mocked_deliver_to_remote.assert_not_called()
|
||||
|
||||
|
||||
def test_deliver_to_remote_success_mark_as_delivered(factories, r_mock, now):
|
||||
delivery = factories["federation.Delivery"]()
|
||||
r_mock.post(delivery.inbox_url)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue