Add updateShare() call.

Signed-off-by: Yahor Berdnikau <egorr.berd@gmail.com>
This commit is contained in:
Yahor Berdnikau 2017-11-19 15:25:31 +01:00
parent 81bb21c841
commit 22ec570b69
2 changed files with 56 additions and 0 deletions

View File

@ -0,0 +1,51 @@
package org.moire.ultrasonic.api.subsonic
import org.junit.Test
/**
* Integration test for [SubsonicAPIDefinition.updateShare] call.
*/
class SubsonicApiUpdateShareTest : SubsonicAPIClientTest() {
@Test
fun `Should handle error response`() {
checkErrorCallParsed(mockWebServerRule) {
client.api.updateShare(11).execute()
}
}
@Test
fun `Should handle ok response`() {
mockWebServerRule.enqueueResponse("ping_ok.json")
val response = client.api.updateShare(12).execute()
assertResponseSuccessful(response)
}
@Test
fun `Should pass id in request params`() {
val id = 4432L
mockWebServerRule.assertRequestParam(expectedParam = "id=$id") {
client.api.updateShare(id = id).execute()
}
}
@Test
fun `Should pass description in request params`() {
val description = "some-description"
mockWebServerRule.assertRequestParam(expectedParam = "description=$description") {
client.api.updateShare(123, description = description).execute()
}
}
@Test
fun `Should pass expires in request params`() {
val expires = 223123123L
mockWebServerRule.assertRequestParam(expectedParam = "expires=$expires") {
client.api.updateShare(12, expires = expires).execute()
}
}
}

View File

@ -207,6 +207,11 @@ interface SubsonicAPIDefinition {
@GET("deleteShare.view")
fun deleteShare(@Query("id") id: Long): Call<SubsonicResponse>
@GET("updateShare.view")
fun updateShare(@Query("id") id: Long,
@Query("description") description: String? = null,
@Query("expires") expires: Long? = null): Call<SubsonicResponse>
@GET("getGenres.view")
fun getGenres(): Call<GenresResponse>