jcheruvelil / MusicRecsAPI

1 stars 0 forks source link

Test results Jenna Chan #10

Open jenchan88 opened 1 month ago

jenchan88 commented 1 month ago

Example flow 1: 1. curl -X 'GET' 'https://musicrecs.onrender.com/search/?track=rolling%20in%20the%20deep&artist=adele&album=21' -H 'accept: application/json' -H 'access_token: musicrecs' 2. Response { "results": [ {

"track_id": "4OSBTYWVwsQhGLF9NHvIbR", "track": "Rolling in the Deep", "album": "21", "artist": "Adele" }

] }

curl -X 'GET' 'https://musicrecs.onrender.com/recs/?track_id=4OSBTYWVwsQhGLF9NHvIbR' -H 'accept: application/json' -H 'access_token: musicrecs'

{ "recommendations": [ { "id": "3JCaq3KDSROg3TXhdiDa9n", "track": "Ley Seca", "album": "Timelezz", "artist": "Jhayco;Anuel AA" }, { "id": "7ef4DlsgrMEH11cDZd32M6", "track": "One Kiss (with Dua Lipa)", "album": "One Kiss (with Dua Lipa)", "artist": "Calvin Harris;Dua Lipa" }, { "id": "4ZxOuNHhpyOj4gv52MtQpT", "track": "As If It's Your Last", "album": "As If It's Your Last", "artist": "BLACKPINK" }, { "id": "5w9c2J52mkdntKOmRLeM2m", "track": "Con Calma", "album": "Con Calma", "artist": "Daddy Yankee;Snow" }, { "id": "18asYwWugKjjsihZ0YvRxO", "track": "The Motto", "album": "The Motto", "artist": "Tiësto;Ava Max" }, { "id": "3GCdLUSnKSMJhs4Tj6CV3s", "track": "All The Stars (with SZA)", "album": "Black Panther The Album Music From And Inspired By", "artist": "Kendrick Lamar;SZA" }, { "id": "09IStsImFySgyp0pIQdqAc", "track": "The Middle", "album": "The Middle", "artist": "Zedd;Maren Morris;Grey" }, { "id": "30qVCFYKBtAENjTIBA8FPZ", "track": "The River of Dreams", "album": "River Of Dreams", "artist": "Billy Joel" }, { "id": "6oJ6le65B3SEqPwMRNXWjY", "track": "Higher Love", "album": "Higher Love", "artist": "Kygo;Whitney Houston" }, { "id": "4R8BJggjosTswLxtkw8V7P", "track": "No Me Conoce - Remix", "album": "Famouz", "artist": "Jhayco;J Balvin;Bad Bunny" } ] }

curl -X 'POST' 'https://musicrecs.onrender.com/rating/12/4OSBTYWVwsQhGLF9NHvIbR' -H 'accept: application/json' -H 'access_token: musicrecs' -H 'Content-Type: application/json' -d '{ "value": 7 }'

"OK"

Example flow 2: 1. curl -X 'GET' 'https://musicrecs.onrender.com/search/?track=talking%20to%20the%20moon&artist=Bruno%20Mars&album=Doo-Wops%20%26%20Hooligans' -H 'accept: application/json' -H 'access_token: musicrecs' 2. { "results": [ { "track_id": "161DnLWsx1i3u1JT05lzqU", "track": "Talking to the Moon", "album": "Doo-Wops & Hooligans", "artist": "Bruno Mars" } ] }

** Could not POST /recommendations with UID. I assume this will be implemented later.

curl -X 'POST' 'https://musicrecs.onrender.com/playlist/18/add/161DnLWsx1i3u1JT05lzqU' -H 'accept: application/json' -H 'access_token: musicrecs' -d '' 4. "OK"

Example flow 3: 1. curl -X 'POST' 'https://musicrecs.onrender.com/user/' -H 'accept: application/json' -H 'access_token: musicrecs' -H 'Content-Type: application/json' -d '{ "username": "Tommy" }' 2. { "user_id": 14 }

curl -X 'POST' 'https://musicrecs.onrender.com/playlist/19/add/161DnLWsx1i3u1JT05lzqU' -H 'accept: application/json' -H 'access_token: musicrecs' -d '' 4. Internal Server Error

** Cannot GET /playlist/{playlist_id} or PUT /playlist/{playlist_id}/add. Possible implementation later?

New test cases: Create a user, Martha. Get playlist details and add a song to the playlist. Martha then decides she no longer wants the song to be in her playlist so remove it from the playlist. 1. curl -X 'POST' \ 'https://musicrecs.onrender.com/user/' \ -H 'accept: application/json' \ -H 'access_token: musicrecs' \ -H 'Content-Type: application/json' \ -d '{ "username": "Martha" }' 2. { "user_id": 16 }

3. curl -X 'POST' \ 'https://musicrecs.onrender.com/playlist/16' \ -H 'accept: application/json' \ -H 'access_token: musicrecs' \ -H 'Content-Type: application/json' \ -d '{ "playlist_name": "myPlaylist" }' 4. { "playlist_id": 20 }

5. curl -X 'POST' \ 'https://musicrecs.onrender.com/playlist/20/add/4u7EnebtmKWzUH433cf5Qv' \ -H 'accept: application/json' \ -H 'access_token: musicrecs' \ -d ''

6. "OK"

7. curl -X 'POST' \ 'https://musicrecs.onrender.com/playlist/20/remove/4u7EnebtmKWzUH433cf5Qv' \ -H 'accept: application/json' \ -H 'access_token: musicrecs' \ -d ''

8. "OK"

Sandra searched for some songs earlier, and came across one she really enjoyed, but unfortunately can’t recall the name. She checks the search history. She’s embarrassed that the song is from the 90’s and is afraid that it will age her, so she deletes her search history. 1. curl -X 'POST' \ 'https://musicrecs.onrender.com/user/' \ -H 'accept: application/json' \ -H 'access_token: musicrecs' \ -H 'Content-Type: application/json' \ -d '{ "username": "Sandra" }' 2. { "user_id": 17 } 3. curl -X 'GET' \ 'https://musicrecs.onrender.com/search/?track=Imagine&artist=John%20Lennon&album=Imagine' \ -H 'accept: application/json' \ -H 'access_token: musicrecs' 4. { "results": [ { "track_id": "7pKfPomDEeI4TPT6EOYjn9", "track": "Imagine - Remastered 2010", "album": "Imagine", "artist": "John Lennon" } ] 5. curl -X 'GET' \ 'https://musicrecs.onrender.com/history/search?user_id=17' \ -H 'accept: application/json' \ -H 'access_token: musicrecs'

6. { "detail": "Search history not found" }

**Given that I searched some songs, I presume this should return those searches rather than returning the above message. 7. curl -X 'DELETE' \ 'https://musicrecs.onrender.com/history/search/clear?user_id=17' \ -H 'accept: application/json' \ -H 'access_token: musicrecs' 8. { "detail": "No search history to clear" }

**Likely related to what is returned by search history, but there should probably be history to clear.

Sandra creates some playlists and then wants to share songs with some friends, so she searches through her library of playlists and finds that she already has one marked for friends. She then adds songs to that playlist. 1. curl -X 'GET' \ 'https://musicrecs.onrender.com/user/17/library' \ -H 'accept: application/json' \ -H 'access_token: musicrecs' 2. [ { "playlist_id": 21, "playlist_title": "mySongs" }, { "playlist_id": 22, "playlist_title": "studyMusic" }, { "playlist_id": 23, "playlist_title": "misc" }, { "playlist_id": 24, "playlist_title": "friends" } ] 3. curl -X 'POST' \ 'https://musicrecs.onrender.com/playlist/12/add/7pKfPomDEeI4TPT6EOYjn9' \ -H 'accept: application/json' \ -H 'access_token: musicrecs' \ -d '' 4. "OK"

**I entered a playlist id that did not correspond to one of 21 through 24, and it yielded the above response.

  1. curl -X 'POST' \ 'https://musicrecs.onrender.com/playlist/12/add/7pKfPomDEeI4TPT6EOYjn9' \ -H 'accept: application/json' \ -H 'access_token: musicrecs' \ -d ''

  2. Internal Server Error ** Here is what resulted from trying to add the same song to the correct friends playlist.