mirror of
https://code.eliotberriot.com/funkwhale/funkwhale.git
synced 2025-10-05 09:49:23 +02:00
See #170: subscribe to 3d-party RSS feeds in Funkwhale
This commit is contained in:
parent
7cae1ae5db
commit
deb1f35779
29 changed files with 1451 additions and 129 deletions
|
@ -1,6 +1,9 @@
|
|||
import uuid
|
||||
|
||||
import factory
|
||||
|
||||
from funkwhale_api.factories import registry, NoUpdateOnCreate
|
||||
from funkwhale_api.federation import actors
|
||||
from funkwhale_api.federation import factories as federation_factories
|
||||
from funkwhale_api.music import factories as music_factories
|
||||
|
||||
|
@ -11,6 +14,10 @@ def set_actor(o):
|
|||
return models.generate_actor(str(o.uuid))
|
||||
|
||||
|
||||
def get_rss_channel_name():
|
||||
return "rssfeed-{}".format(uuid.uuid4())
|
||||
|
||||
|
||||
@registry.register
|
||||
class ChannelFactory(NoUpdateOnCreate, factory.django.DjangoModelFactory):
|
||||
uuid = factory.Faker("uuid4")
|
||||
|
@ -32,10 +39,20 @@ class ChannelFactory(NoUpdateOnCreate, factory.django.DjangoModelFactory):
|
|||
model = "audio.Channel"
|
||||
|
||||
class Params:
|
||||
external = factory.Trait(
|
||||
attributed_to=factory.LazyFunction(actors.get_service_actor),
|
||||
library__privacy_level="me",
|
||||
actor=factory.SubFactory(
|
||||
federation_factories.ActorFactory,
|
||||
local=True,
|
||||
preferred_username=factory.LazyFunction(get_rss_channel_name),
|
||||
),
|
||||
)
|
||||
local = factory.Trait(
|
||||
attributed_to=factory.SubFactory(
|
||||
federation_factories.ActorFactory, local=True
|
||||
),
|
||||
library__privacy_level="everyone",
|
||||
artist__local=True,
|
||||
)
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue