mirror of
https://github.com/ultrasonic/ultrasonic
synced 2025-01-31 09:27:04 +01:00
Add createBookmark() call.
Signed-off-by: Yahor Berdnikau <egorr.berd@gmail.com>
This commit is contained in:
parent
f583006ad6
commit
010d7679b9
@ -0,0 +1,51 @@
|
||||
package org.moire.ultrasonic.api.subsonic
|
||||
|
||||
import org.junit.Test
|
||||
|
||||
/**
|
||||
* Integration test for [SubsonicAPIDefinition.createBookmark] call.
|
||||
*/
|
||||
class SubsonicApiCreateBookmarkTest : SubsonicAPIClientTest() {
|
||||
@Test
|
||||
fun `Should handle error response`() {
|
||||
checkErrorCallParsed(mockWebServerRule) {
|
||||
client.api.createBookmark(1, 1).execute()
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `Should handle ok response`() {
|
||||
mockWebServerRule.enqueueResponse("ping_ok.json")
|
||||
|
||||
val response = client.api.createBookmark(213, 123213L).execute()
|
||||
|
||||
assertResponseSuccessful(response)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `Should pass id in request params`() {
|
||||
val id = 544
|
||||
|
||||
mockWebServerRule.assertRequestParam(expectedParam = "id=$id") {
|
||||
client.api.createBookmark(id = id, position = 123).execute()
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `Should pass position in request params`() {
|
||||
val position = 4412333L
|
||||
|
||||
mockWebServerRule.assertRequestParam(expectedParam = "position=$position") {
|
||||
client.api.createBookmark(id = 12, position = position).execute()
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `Should pass comment in request params`() {
|
||||
val comment = "some-comment"
|
||||
|
||||
mockWebServerRule.assertRequestParam(expectedParam = "comment=$comment") {
|
||||
client.api.createBookmark(id = 1, position = 1, comment = comment).execute()
|
||||
}
|
||||
}
|
||||
}
|
@ -224,4 +224,10 @@ interface SubsonicAPIDefinition {
|
||||
|
||||
@GET("getBookmarks.view")
|
||||
fun getBookmarks(): Call<BookmarksResponse>
|
||||
|
||||
@GET("createBookmark.view")
|
||||
fun createBookmark(
|
||||
@Query("id") id: Int,
|
||||
@Query("position") position: Long,
|
||||
@Query("comment") comment: String? = null): Call<SubsonicResponse>
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user