1
0
mirror of https://github.com/ultrasonic/ultrasonic synced 2025-02-16 19:50:35 +01:00

Add unstar request.

Signed-off-by: Yahor Berdnikau <egorr.berd@gmail.com>
This commit is contained in:
Yahor Berdnikau 2017-08-17 23:00:51 +02:00
parent 0563c39cdc
commit 34b49f67a2
2 changed files with 66 additions and 0 deletions

View File

@ -0,0 +1,61 @@
package org.moire.ultrasonic.api.subsonic
import org.amshove.kluent.`should be`
import org.amshove.kluent.`should contain`
import org.junit.Test
import org.moire.ultrasonic.api.subsonic.response.SubsonicResponse
/**
* Intergration test for [SubsonicAPIClient] for unstar call.
*/
class SubsonicApiUnstarTest : SubsonicAPIClientTest() {
@Test
fun `Should parse ok response`() {
mockWebServerRule.enqueueResponse("ping_ok.json")
val response = client.api.unstar().execute()
assertResponseSuccessful(response)
response.body().status `should be` SubsonicResponse.Status.OK
}
@Test
fun `Should parse error response`() {
checkErrorCallParsed(mockWebServerRule, {
client.api.unstar().execute()
})
}
@Test
fun `Should pass id param`() {
mockWebServerRule.enqueueResponse("ping_ok.json")
val id = 545L
client.api.unstar(id = id).execute()
val request = mockWebServerRule.mockWebServer.takeRequest()
request.requestLine `should contain` "id=$id"
}
@Test
fun `Should pass artistId param`() {
mockWebServerRule.enqueueResponse("ping_ok.json")
val artistId = 644L
client.api.unstar(artistId = artistId).execute()
val request = mockWebServerRule.mockWebServer.takeRequest()
request.requestLine `should contain` "artistId=$artistId"
}
@Test
fun `Should pass albumId param`() {
mockWebServerRule.enqueueResponse("ping_ok.json")
val albumId = 3344L
client.api.unstar(albumId = albumId).execute()
val request = mockWebServerRule.mockWebServer.takeRequest()
request.requestLine `should contain` "albumId=$albumId"
}
}

View File

@ -39,4 +39,9 @@ interface SubsonicAPIDefinition {
fun star(@Query("id") id: Long? = null,
@Query("albumId") albumId: Long? = null,
@Query("artistId") artistId: Long? = null): Call<SubsonicResponse>
@GET("unstar.view")
fun unstar(@Query("id") id: Long? = null,
@Query("albumId") albumId: Long? = null,
@Query("artistId") artistId: Long? = null): Call<SubsonicResponse>
}