mirror of
https://code.eliotberriot.com/funkwhale/funkwhale.git
synced 2025-10-05 07:49:23 +02:00
Fix #564: Added a script to prune pre 0.17 federated tracks
This commit is contained in:
parent
b453769a32
commit
6aaa51e8e7
5 changed files with 56 additions and 1 deletions
|
@ -12,7 +12,12 @@ def command():
|
|||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"script_name", ["django_permissions_to_user_permissions", "test"]
|
||||
"script_name",
|
||||
[
|
||||
"django_permissions_to_user_permissions",
|
||||
"test",
|
||||
"delete_pre_017_federated_uploads",
|
||||
],
|
||||
)
|
||||
def test_script_command_list(command, script_name, mocker):
|
||||
mocked = mocker.patch("funkwhale_api.common.scripts.{}.main".format(script_name))
|
||||
|
@ -235,3 +240,17 @@ def test_migrate_to_users_libraries_command(
|
|||
|
||||
for part in ["followers", "following"]:
|
||||
generate_actor_urls.assert_any_call(part, command.stdout)
|
||||
|
||||
|
||||
def test_delete_pre_017_federated_uploads(factories, command):
|
||||
to_delete = factories["music.Upload"](
|
||||
source="https://test.com/federation/music/file/1"
|
||||
)
|
||||
to_keep = factories["music.Upload"](source="https://hello.world")
|
||||
|
||||
scripts.delete_pre_017_federated_uploads.main(command)
|
||||
|
||||
to_keep.refresh_from_db()
|
||||
|
||||
with pytest.raises(to_delete.__class__.DoesNotExist):
|
||||
to_delete.refresh_from_db()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue