1
0
mirror of https://github.com/ultrasonic/ultrasonic synced 2025-01-23 13:40:30 +01:00

Add star request.

Signed-off-by: Yahor Berdnikau <egorr.berd@gmail.com>
This commit is contained in:
Yahor Berdnikau 2017-08-17 22:06:20 +02:00
parent 67718a3095
commit fdd9540f75
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
/**
* Integration test for [SubsonicAPIClient] for star request.
*/
class SubsonicApiStarTest : SubsonicAPIClientTest() {
@Test
fun `Should parse star ok response`() {
mockWebServerRule.enqueueResponse("ping_ok.json")
val response = client.api.star().execute()
assertResponseSuccessful(response)
response.body().status `should be` SubsonicResponse.Status.OK
}
@Test
fun `Should parse star error response`() {
checkErrorCallParsed(mockWebServerRule, {
client.api.star().execute()
})
}
@Test
fun `Should pass id param`() {
mockWebServerRule.enqueueResponse("ping_ok.json")
val id = 110L
client.api.star(id = id).execute()
val request = mockWebServerRule.mockWebServer.takeRequest()
request.requestLine `should contain` "id=$id"
}
@Test
fun `Should pass artist id param`() {
mockWebServerRule.enqueueResponse("ping_ok.json")
val artistId = 123L
client.api.star(artistId = artistId).execute()
val request = mockWebServerRule.mockWebServer.takeRequest()
request.requestLine `should contain` "artistId=$artistId"
}
@Test
fun `Should pass albom id param`() {
mockWebServerRule.enqueueResponse("ping_ok.json")
val albumId = 1001L
client.api.star(albumId = albumId).execute()
val request = mockWebServerRule.mockWebServer.takeRequest()
request.requestLine `should contain` "albumId=$albumId"
}
}

View File

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