-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
It currently expects the images to be within a nested `result` list but the API provides a top level block roughly matching the TmdbImages class.
- Loading branch information
1 parent
f58de31
commit 6d23372
Showing
4 changed files
with
2,360 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
42 changes: 42 additions & 0 deletions
42
tmdb-api/src/jvmTest/kotlin/app/moviebase/tmdb/api/TmdbSeasonApiTest.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
package app.moviebase.tmdb.api | ||
|
||
import app.moviebase.tmdb.core.mockHttpClient | ||
import app.moviebase.tmdb.model.AppendResponse | ||
import kotlin.test.assertEquals | ||
import kotlin.test.assertNotNull | ||
import kotlinx.coroutines.test.runTest | ||
import org.junit.jupiter.api.Test | ||
|
||
class TmdbSeasonApiTest { | ||
|
||
val client = mockHttpClient( | ||
version = 3, | ||
responses = mapOf( | ||
"tv/63333/season/1?append_to_response=release_dates,images,credits,tv_credits,external_ids&include_image_language=" to "tv/tv_season_63333_season_1.json", | ||
), | ||
) | ||
val classToTest = TmdbShowSeasonsApi(client) | ||
|
||
@Test | ||
fun `it can fetch season details with images`() = runTest { | ||
val seasonDetails = classToTest.getDetails( | ||
63333, | ||
1, | ||
null, | ||
listOf( | ||
AppendResponse.RELEASES_DATES, | ||
AppendResponse.IMAGES, | ||
AppendResponse.CREDITS, | ||
AppendResponse.TV_CREDITS, | ||
AppendResponse.EXTERNAL_IDS, | ||
), | ||
"", | ||
) | ||
|
||
assertEquals(68878, seasonDetails.id) | ||
assertNotNull(seasonDetails.images) | ||
|
||
val imageFile = seasonDetails.images?.posters?.firstOrNull() | ||
assertEquals("/oQasSKPcBLcEG5rOUg3s1Ozpr4s.jpg", imageFile?.filePath) | ||
} | ||
} |
Oops, something went wrong.