mirror of
https://github.com/ultrasonic/ultrasonic
synced 2025-02-03 02:27:31 +01:00
Add star request.
Signed-off-by: Yahor Berdnikau <egorr.berd@gmail.com>
This commit is contained in:
parent
67718a3095
commit
fdd9540f75
@ -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"
|
||||||
|
}
|
||||||
|
}
|
@ -34,4 +34,9 @@ interface SubsonicAPIDefinition {
|
|||||||
|
|
||||||
@GET("getArtists.view")
|
@GET("getArtists.view")
|
||||||
fun getArtists(@Query("musicFolderId") musicFolderId: Long?): Call<GetArtistsResponse>
|
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>
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user