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:
parent
0563c39cdc
commit
34b49f67a2
@ -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"
|
||||
}
|
||||
}
|
@ -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>
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user