mirror of
https://github.com/commons-app/apps-android-commons.git
synced 2025-10-27 21:03:54 +01:00
Fix image not loading issue in peer review (#2902)
* Fix image loading issue in peer review * With more test cases
This commit is contained in:
parent
482cad6663
commit
accb880256
2 changed files with 20 additions and 4 deletions
|
|
@ -50,12 +50,28 @@ class ReviewHelperTest {
|
|||
.thenReturn(Single.just(listOf(recentChange, recentChange1, recentChange2)))
|
||||
|
||||
`when`(mediaWikiApi?.pageExists(ArgumentMatchers.anyString()))
|
||||
.thenReturn(Single.just(true))
|
||||
.thenReturn(Single.just(false))
|
||||
val randomMedia = reviewHelper?.randomMedia?.blockingGet()
|
||||
|
||||
assertTrue(randomMedia is Media)
|
||||
}
|
||||
|
||||
/**
|
||||
* Test scenario when all media is already nominated for deletion
|
||||
*/
|
||||
@Test(expected = Exception::class)
|
||||
fun getRandomMediaWithWithAllMediaNominatedForDeletion() {
|
||||
val recentChange = getMockRecentChange("test", "File:Test1.jpeg", 0)
|
||||
val recentChange1 = getMockRecentChange("test", "File:Test2.png", 0)
|
||||
val recentChange2 = getMockRecentChange("test", "File:Test3.jpg", 0)
|
||||
`when`(okHttpJsonApiClient?.recentFileChanges)
|
||||
.thenReturn(Single.just(listOf(recentChange, recentChange1, recentChange2)))
|
||||
|
||||
`when`(mediaWikiApi?.pageExists(ArgumentMatchers.anyString()))
|
||||
.thenReturn(Single.just(true))
|
||||
reviewHelper?.randomMedia?.blockingGet()
|
||||
}
|
||||
|
||||
fun getMockRecentChange(type: String, title: String, oldRevisionId: Long): RecentChange {
|
||||
val recentChange = mock(RecentChange::class.java)
|
||||
`when`(recentChange!!.type).thenReturn(type)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue