2017-11-18 21:55:07 +01:00
|
|
|
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) {
|
2017-12-16 22:14:01 +01:00
|
|
|
client.api.createBookmark("1", 1).execute()
|
2017-11-18 21:55:07 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
@Test
|
|
|
|
fun `Should handle ok response`() {
|
|
|
|
mockWebServerRule.enqueueResponse("ping_ok.json")
|
|
|
|
|
2017-12-16 22:14:01 +01:00
|
|
|
val response = client.api.createBookmark("213", 123213L).execute()
|
2017-11-18 21:55:07 +01:00
|
|
|
|
|
|
|
assertResponseSuccessful(response)
|
|
|
|
}
|
|
|
|
|
|
|
|
@Test
|
|
|
|
fun `Should pass id in request params`() {
|
2017-12-16 22:14:01 +01:00
|
|
|
val id = "544"
|
2017-11-18 21:55:07 +01:00
|
|
|
|
|
|
|
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") {
|
2017-12-16 22:14:01 +01:00
|
|
|
client.api.createBookmark(id = "12", position = position).execute()
|
2017-11-18 21:55:07 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
@Test
|
|
|
|
fun `Should pass comment in request params`() {
|
|
|
|
val comment = "some-comment"
|
|
|
|
|
|
|
|
mockWebServerRule.assertRequestParam(expectedParam = "comment=$comment") {
|
2017-12-16 22:14:01 +01:00
|
|
|
client.api.createBookmark(id = "1", position = 1, comment = comment).execute()
|
2017-11-18 21:55:07 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|