mirror of
https://code.eliotberriot.com/funkwhale/funkwhale.git
synced 2025-10-04 13:59:15 +02:00
Audio federation
This commit is contained in:
parent
6992c567fb
commit
e49a460203
85 changed files with 2598 additions and 1204 deletions
|
@ -49,24 +49,24 @@ def test_migrate_to_user_libraries(factories, command):
|
|||
user1 = factories["users.User"](is_superuser=False, with_actor=True)
|
||||
user2 = factories["users.User"](is_superuser=True, with_actor=True)
|
||||
factories["users.User"](is_superuser=True)
|
||||
no_import_files = factories["music.TrackFile"].create_batch(size=5, library=None)
|
||||
no_import_files = factories["music.Upload"].create_batch(size=5, library=None)
|
||||
import_jobs = factories["music.ImportJob"].create_batch(
|
||||
batch__submitted_by=user1, size=5, finished=True
|
||||
)
|
||||
# we delete libraries that are created automatically
|
||||
for j in import_jobs:
|
||||
j.track_file.library = None
|
||||
j.track_file.save()
|
||||
j.upload.library = None
|
||||
j.upload.save()
|
||||
scripts.migrate_to_user_libraries.main(command)
|
||||
|
||||
# tracks with import jobs are bound to the importer's library
|
||||
library = user1.actor.libraries.get(name="default")
|
||||
assert list(library.files.order_by("id").values_list("id", flat=True)) == sorted(
|
||||
[ij.track_file.pk for ij in import_jobs]
|
||||
assert list(library.uploads.order_by("id").values_list("id", flat=True)) == sorted(
|
||||
[ij.upload.pk for ij in import_jobs]
|
||||
)
|
||||
|
||||
# tracks without import jobs are bound to first superuser
|
||||
library = user2.actor.libraries.get(name="default")
|
||||
assert list(library.files.order_by("id").values_list("id", flat=True)) == sorted(
|
||||
[tf.pk for tf in no_import_files]
|
||||
assert list(library.uploads.order_by("id").values_list("id", flat=True)) == sorted(
|
||||
[upload.pk for upload in no_import_files]
|
||||
)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue