2017-12-24 18:15:21 +00:00
|
|
|
import factory
|
|
|
|
|
2019-01-04 13:36:08 +00:00
|
|
|
from funkwhale_api.factories import registry, NoUpdateOnCreate
|
2018-03-18 20:31:59 +00:00
|
|
|
from funkwhale_api.music.factories import TrackFactory
|
2017-12-24 18:15:21 +00:00
|
|
|
from funkwhale_api.users.factories import UserFactory
|
|
|
|
|
|
|
|
|
|
|
|
@registry.register
|
2019-01-04 13:36:08 +00:00
|
|
|
class PlaylistFactory(NoUpdateOnCreate, factory.django.DjangoModelFactory):
|
2018-06-09 13:36:16 +00:00
|
|
|
name = factory.Faker("name")
|
2017-12-24 18:15:21 +00:00
|
|
|
user = factory.SubFactory(UserFactory)
|
|
|
|
|
|
|
|
class Meta:
|
2018-06-09 13:36:16 +00:00
|
|
|
model = "playlists.Playlist"
|
2018-03-18 20:31:59 +00:00
|
|
|
|
|
|
|
|
|
|
|
@registry.register
|
2019-01-04 13:36:08 +00:00
|
|
|
class PlaylistTrackFactory(NoUpdateOnCreate, factory.django.DjangoModelFactory):
|
2018-03-18 20:31:59 +00:00
|
|
|
playlist = factory.SubFactory(PlaylistFactory)
|
|
|
|
track = factory.SubFactory(TrackFactory)
|
|
|
|
|
|
|
|
class Meta:
|
2018-06-09 13:36:16 +00:00
|
|
|
model = "playlists.PlaylistTrack"
|