mirror of
https://code.eliotberriot.com/funkwhale/funkwhale.git
synced 2025-10-05 00:39:16 +02:00
See #852: improved routing logic for federation messages (support multiple objects types for one route)
This commit is contained in:
parent
1aa3f3f340
commit
9f3182caf7
19 changed files with 561 additions and 54 deletions
32
api/tests/users/test_tasks.py
Normal file
32
api/tests/users/test_tasks.py
Normal file
|
@ -0,0 +1,32 @@
|
|||
import pytest
|
||||
|
||||
from funkwhale_api.federation import routes
|
||||
from funkwhale_api.users import tasks
|
||||
|
||||
|
||||
def test_delete_account(factories, mocker):
|
||||
user = factories["users.User"]()
|
||||
actor = user.create_actor()
|
||||
library = factories["music.Library"](actor=actor)
|
||||
unrelated_library = factories["music.Library"]()
|
||||
dispatch = mocker.patch.object(routes.outbox, "dispatch")
|
||||
|
||||
tasks.delete_account(user_id=user.pk)
|
||||
|
||||
dispatch.assert_called_once_with(
|
||||
{"type": "Delete", "object": {"type": actor.type}}, context={"actor": actor}
|
||||
)
|
||||
|
||||
with pytest.raises(user.DoesNotExist):
|
||||
user.refresh_from_db()
|
||||
|
||||
with pytest.raises(library.DoesNotExist):
|
||||
library.refresh_from_db()
|
||||
|
||||
# this one shouldn't be deleted
|
||||
unrelated_library.refresh_from_db()
|
||||
actor.refresh_from_db()
|
||||
|
||||
assert actor.type == "Tombstone"
|
||||
assert actor.name is None
|
||||
assert actor.summary is None
|
Loading…
Add table
Add a link
Reference in a new issue