except ValueError:
abort(400)
- file = request.files["song"] if "song" in request.files else None
+ file = request.files["song-file"] if "song-file" in request.files else None
yt_url = request.form["song-url"] if "song-url" in request.form else None
title = request.form["title"]
description = request.form["description"]
return error
def create_song():
- file = request.files["song"] if "song" in request.files else None
+ file = request.files["song-file"] if "song-file" in request.files else None
yt_url = request.form["song-url"] if "song-url" in request.form else None
title = request.form["title"]
description = request.form["description"]
song_file = open(filename, "rb")
data = {
- "song": song_file,
+ "song-file": song_file,
"title": "song title",
"description": "song description",
"tags": "tag",
def test_update_song_invalid_mp3(client):
_create_user_and_song(client)
- song_file = open(__file__, "rb")
- _test_upload_song(client, b"Invalid audio file", error=True, songid=1, song=song_file)
+ _test_upload_song(client, b"Invalid audio file", error=True, songid=1, filename=__file__)
def test_update_song_invalid_song(client):
_create_user_and_song(client)
data = {
- "song": open("sample-3s.mp3", "rb"),
+ "song-file": open("sample-3s.mp3", "rb"),
"title": "song title",
"description": "song description",
"tags": "tag",
_create_user_and_song(client)
data = {
- "song": open("sample-3s.mp3", "rb"),
+ "song-file": open("sample-3s.mp3", "rb"),
"title": "song title",
"description": "song description",
"tags": "tag",
_create_user(client, "user2", login=True)
data = {
- "song": open("sample-3s.mp3", "rb"),
+ "song-file": open("sample-3s.mp3", "rb"),
"title": "song title",
"description": "song description",
"tags": "tag",