Cleanup Spotify tests

This commit is contained in:
Tobias Gesellchen
2026-04-06 15:22:06 +02:00
parent e5b94158e6
commit 740cf54b9d
4 changed files with 11 additions and 21 deletions
+7 -7
View File
@@ -39,10 +39,10 @@ func HandleToken(w http.ResponseWriter, r *http.Request) {
log.Printf("[Spotify Mock] Grant type: %s", grantType)
resp := map[string]interface{}{
"access_token": "mock-access-token",
"access_token": "spotify-access-token",
"token_type": "Bearer",
"expires_in": 3600,
"refresh_token": "mock-refresh-token",
"refresh_token": "spotify-refresh-token",
"scope": "user-read-private user-read-email",
}
@@ -76,16 +76,16 @@ func HandleMe(w http.ResponseWriter, r *http.Request) {
log.Printf("[Spotify Mock] Profile request: %s", r.Method)
auth := r.Header.Get("Authorization")
if auth != "Bearer mock-access-token" {
if auth != "Bearer spotify-access-token" {
http.Error(w, `{"error":"unauthorized"}`, http.StatusUnauthorized)
return
}
resp := map[string]interface{}{
"id": "mock-user-id",
"display_name": "Mock User",
"email": "mock@example.com",
"uri": "spotify:user:mock-user-id",
"id": "spotify-user-id",
"display_name": "Spotify Test User",
"email": "spotify-test@example.com",
"uri": "spotify:user:spotify-user-id",
}
w.Header().Set("Content-Type", "application/json")
@@ -23,7 +23,7 @@ Content-Type: application/json
client.test("Response body has expected structure", function() {
client.assert(response.body.hasOwnProperty("access_token"), "Response body missing 'access_token'");
client.assert(response.body.access_token === "mock-access-token", "access_token is not 'mock-access-token'");
client.assert(response.body.access_token === "spotify-access-token", "access_token is not 'spotify-access-token'");
client.assert(response.body.hasOwnProperty("expires_in"), "Response body missing 'expires_in'");
client.assert(typeof response.body.expires_in === "number", "expires_in is not a number");
@@ -25,12 +25,12 @@ Authorization: Basic admin change_me!
client.assert(response.body.accounts.length > 0, "No accounts found");
var found = false;
for (var i = 0; i < response.body.accounts.length; i++) {
if (response.body.accounts[i].user_id === "mock-user-id") {
if (response.body.accounts[i].user_id === "spotify-user-id") {
found = true;
client.assert(response.body.accounts[i].display_name === "Mock User", "Display name mismatch");
client.assert(response.body.accounts[i].display_name === "Spotify Test User", "Display name mismatch");
break;
}
}
client.assert(found, "Account 'mock-user-id' not found in " + JSON.stringify(response.body.accounts));
client.assert(found, "Account 'spotify-user-id' not found in " + JSON.stringify(response.body.accounts));
});
%}
-10
View File
@@ -1,10 +0,0 @@
{
"test-user": {
"user_id": "test-user",
"display_name": "Integration Test User",
"email": "test@example.com",
"access_token": "mock-access-token",
"refresh_token": "mock-refresh-token",
"expires_at": 2147483647
}
}