Moved playlist tests in a dedicated directory

This commit is contained in:
Eliot Berriot 2018-03-16 22:55:35 +01:00
parent fe51b6db19
commit 639cd5da5b
No known key found for this signature in database
GPG Key ID: DD6965E2476E5C27
2 changed files with 20 additions and 21 deletions

View File

@ -0,0 +1,20 @@
def test_can_create_playlist(factories):
tracks = factories['music.Track'].create_batch(5)
playlist = factories['playlists.Playlist']()
previous = None
for track in tracks:
previous = playlist.add_track(track, previous=previous)
playlist_tracks = list(playlist.playlist_tracks.all())
previous = None
for idx, track in enumerate(tracks):
plt = playlist_tracks[idx]
assert plt.position == idx
assert plt.track == track
if previous:
assert playlist_tracks[idx + 1] == previous
assert plt.playlist == playlist

View File

@ -7,27 +7,6 @@ from funkwhale_api.playlists import models
from funkwhale_api.playlists.serializers import PlaylistSerializer
def test_can_create_playlist(factories):
tracks = factories['music.Track'].create_batch(5)
playlist = factories['playlists.Playlist']()
previous = None
for track in tracks:
previous = playlist.add_track(track, previous=previous)
playlist_tracks = list(playlist.playlist_tracks.all())
previous = None
for idx, track in enumerate(tracks):
plt = playlist_tracks[idx]
assert plt.position == idx
assert plt.track == track
if previous:
assert playlist_tracks[idx + 1] == previous
assert plt.playlist == playlist
def test_can_create_playlist_via_api(logged_in_client):
url = reverse('api:v1:playlists-list')
data = {