Add getStarred2() call.
Signed-off-by: Yahor Berdnikau <egorr.berd@gmail.com>
This commit is contained in:
parent
19f5dde397
commit
f85759eb58
|
@ -0,0 +1,48 @@
|
|||
package org.moire.ultrasonic.api.subsonic
|
||||
|
||||
import org.amshove.kluent.`should equal to`
|
||||
import org.amshove.kluent.`should equal`
|
||||
import org.junit.Test
|
||||
import org.moire.ultrasonic.api.subsonic.models.Artist
|
||||
import org.moire.ultrasonic.api.subsonic.models.SearchTwoResult
|
||||
|
||||
/**
|
||||
* Integration test for [SubsonicAPIClient] for getStarred2 call.
|
||||
*/
|
||||
@Suppress("NamingConventionViolation")
|
||||
class SubsonicApiGetStarred2Test : SubsonicAPIClientTest() {
|
||||
@Test
|
||||
fun `Should handle error response`() {
|
||||
val response = checkErrorCallParsed(mockWebServerRule) {
|
||||
client.api.getStarred2().execute()
|
||||
}
|
||||
|
||||
response.starred2 `should equal` SearchTwoResult()
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `Should handle ok reponse`() {
|
||||
mockWebServerRule.enqueueResponse("get_starred_2_ok.json")
|
||||
|
||||
val response = client.api.getStarred2().execute()
|
||||
|
||||
assertResponseSuccessful(response)
|
||||
with(response.body().starred2) {
|
||||
albumList `should equal` emptyList()
|
||||
artistList.size `should equal to` 1
|
||||
artistList[0] `should equal` Artist(id = 364, name = "Parov Stelar",
|
||||
starred = parseDate("2017-08-12T18:32:58.768Z"))
|
||||
songList `should equal` emptyList()
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `Should pass music folder id in request param`() {
|
||||
val musicFolderId = 441L
|
||||
|
||||
mockWebServerRule.assertRequestParam(responseResourceName = "get_starred_2_ok.json",
|
||||
expectedParam = "musicFolderId=$musicFolderId") {
|
||||
client.api.getStarred2(musicFolderId = musicFolderId).execute()
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,13 @@
|
|||
{
|
||||
"subsonic-response" : {
|
||||
"status" : "ok",
|
||||
"version" : "1.15.0",
|
||||
"starred2" : {
|
||||
"artist" : [ {
|
||||
"id" : "364",
|
||||
"name" : "Parov Stelar",
|
||||
"starred" : "2017-08-12T18:32:58.768Z"
|
||||
} ]
|
||||
}
|
||||
}
|
||||
}
|
|
@ -14,6 +14,7 @@ import org.moire.ultrasonic.api.subsonic.response.GetPlaylistsResponse
|
|||
import org.moire.ultrasonic.api.subsonic.response.GetPodcastsResponse
|
||||
import org.moire.ultrasonic.api.subsonic.response.GetRandomSongsResponse
|
||||
import org.moire.ultrasonic.api.subsonic.response.GetStarredResponse
|
||||
import org.moire.ultrasonic.api.subsonic.response.GetStarredTwoResponse
|
||||
import org.moire.ultrasonic.api.subsonic.response.LicenseResponse
|
||||
import org.moire.ultrasonic.api.subsonic.response.MusicFoldersResponse
|
||||
import org.moire.ultrasonic.api.subsonic.response.SearchResponse
|
||||
|
@ -156,4 +157,7 @@ interface SubsonicAPIDefinition {
|
|||
|
||||
@GET("getStarred.view")
|
||||
fun getStarred(@Query("musicFolderId") musicFolderId: Long? = null): Call<GetStarredResponse>
|
||||
|
||||
@GET("getStarred2.view")
|
||||
fun getStarred2(@Query("musicFolderId") musicFolderId: Long? = null): Call<GetStarredTwoResponse>
|
||||
}
|
||||
|
|
|
@ -0,0 +1,11 @@
|
|||
package org.moire.ultrasonic.api.subsonic.response
|
||||
|
||||
import org.moire.ultrasonic.api.subsonic.SubsonicAPIVersions
|
||||
import org.moire.ultrasonic.api.subsonic.SubsonicError
|
||||
import org.moire.ultrasonic.api.subsonic.models.SearchTwoResult
|
||||
|
||||
class GetStarredTwoResponse(status: Status,
|
||||
version: SubsonicAPIVersions,
|
||||
error: SubsonicError?,
|
||||
val starred2: SearchTwoResult = SearchTwoResult())
|
||||
: SubsonicResponse(status, version, error)
|
Loading…
Reference in New Issue