mirror of
https://github.com/ultrasonic/ultrasonic
synced 2025-02-18 04:30:48 +01:00
Add updateShare() call.
Signed-off-by: Yahor Berdnikau <egorr.berd@gmail.com>
This commit is contained in:
parent
81bb21c841
commit
22ec570b69
@ -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()
|
||||
}
|
||||
}
|
||||
}
|
@ -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>
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user