]> littlesong.place Git - littlesongplace.git/commitdiff
Use online tests for youtube since it thinks github server is a bot
authorChris Fulljames <christianfulljames@gmail.com>
Sat, 8 Feb 2025 18:01:50 +0000 (13:01 -0500)
committerChris Fulljames <christianfulljames@gmail.com>
Sat, 8 Feb 2025 18:01:50 +0000 (13:01 -0500)
test/test_offline.py
test/test_online.py

index 9d25fdfd0ebb0d331dced118a04671a2ae9d324a..59af5b7837f924e626466dfb84cff50107eb96a6 100644 (file)
@@ -303,6 +303,7 @@ def test_upload_song_from_mp4(client):
     _create_user(client, "user", "password", login=True)
     _test_upload_song(client, b"Successfully uploaded &#39;song title&#39;", filename="sample-4s.mp4")
 
+@pytest.skip
 def test_upload_song_from_youtube(client):
     _create_user(client, "user", "password", login=True)
     data = {
@@ -353,6 +354,7 @@ def test_update_song_success(client):
     with open("sample-6s.mp3", "rb") as expected_file:
         assert response.data == expected_file.read()
 
+@pytest.skip
 def test_update_song_from_youtube(client):
     _create_user_and_song(client)
     data = {
index 3347190279ea06c9f65734dd16b54f8e1b2b0888..292c735c430c6bc4333399a0a57e8351ff515017 100644 (file)
@@ -97,3 +97,20 @@ def test_comments_and_activity(s):
         songs = _get_song_list_from_page(response.text)
         assert not any(song["songid"] == songid for song in songs)
 
+def test_upload_song_from_youtube(s):
+    _login(s, "user", "1234asdf!@#$")
+
+    response = s.post(
+        url("/upload-song"),
+        data={"title": "yt-song", "description": "", "tags": "", "collabs": "", "song-url": "https://youtu.be/5e5Z6gZWiEs"},
+    )
+    response.raise_for_status()
+    songs = _get_song_list_from_page(response.text)
+    song = songs[0]
+    songid = song["songid"]
+    try:
+        assert song["title"] == "yt-song"
+    finally:
+        response = s.get(url(f"/delete-song/{songid}"), headers={"referer": "/users/user"})
+        response.raise_for_status()
+