mirror of
https://github.com/ultrasonic/ultrasonic
synced 2025-02-10 00:30:43 +01:00
Merge pull request #43 from ultrasonic/add-delete-playlist
Add delete playlist
This commit is contained in:
commit
02902023da
@ -0,0 +1,34 @@
|
||||
package org.moire.ultrasonic.api.subsonic
|
||||
|
||||
import org.junit.Test
|
||||
|
||||
/**
|
||||
* Instrumentation test for [SubsonicAPIClient] for deletePlaylist call.
|
||||
*/
|
||||
class SubsonicApiDeletePlaylistTest : SubsonicAPIClientTest() {
|
||||
@Test
|
||||
fun `Should handle error response`() {
|
||||
checkErrorCallParsed(mockWebServerRule) {
|
||||
client.api.deletePlaylist(10).execute()
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `Should handle ok response`() {
|
||||
mockWebServerRule.enqueueResponse("ping_ok.json")
|
||||
|
||||
val response = client.api.deletePlaylist(10).execute()
|
||||
|
||||
assertResponseSuccessful(response)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `Should pass id param in request`() {
|
||||
val id = 534L
|
||||
|
||||
mockWebServerRule.assertRequestParam(responseResourceName = "ping_ok.json",
|
||||
expectedParam = "id=$id") {
|
||||
client.api.deletePlaylist(id).execute()
|
||||
}
|
||||
}
|
||||
}
|
@ -96,4 +96,7 @@ interface SubsonicAPIDefinition {
|
||||
fun createPlaylist(@Query("playlistId") id: Long? = null,
|
||||
@Query("name") name: String? = null,
|
||||
@Query("songId") songIds: List<Long>? = null): Call<SubsonicResponse>
|
||||
|
||||
@GET("deletePlaylist.view")
|
||||
fun deletePlaylist(@Query("id") id: Long): Call<SubsonicResponse>
|
||||
}
|
||||
|
@ -593,19 +593,17 @@ public class RESTMusicService implements MusicService
|
||||
checkResponseSuccessful(response);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deletePlaylist(String id, Context context, ProgressListener progressListener) throws Exception
|
||||
{
|
||||
Reader reader = getReader(context, progressListener, "deletePlaylist", null, "id", id);
|
||||
try
|
||||
{
|
||||
new ErrorParser(context).parse(reader);
|
||||
}
|
||||
finally
|
||||
{
|
||||
Util.close(reader);
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public void deletePlaylist(String id,
|
||||
Context context,
|
||||
ProgressListener progressListener) throws Exception {
|
||||
Long pId = id == null ? null : Long.valueOf(id);
|
||||
|
||||
updateProgressListener(progressListener, R.string.parser_reading);
|
||||
Response<SubsonicResponse> response = subsonicAPIClient.getApi()
|
||||
.deletePlaylist(pId).execute();
|
||||
checkResponseSuccessful(response);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updatePlaylist(String id, String name, String comment, boolean pub, Context context, ProgressListener progressListener) throws Exception
|
||||
|
Loading…
x
Reference in New Issue
Block a user