mirror of
https://github.com/commons-app/apps-android-commons.git
synced 2025-10-27 21:03:54 +01:00
Do not use erroneous thumb url util function (#2901)
* Do not use erroneous thumb url util function * Remove unused code * Fix image loading for peer review * Clear disposable
This commit is contained in:
parent
70b19754fb
commit
a003e9706f
8 changed files with 28 additions and 88 deletions
|
|
@ -180,23 +180,6 @@ class ContributionDaoTest {
|
|||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
fun saveNewContribution_nullableImageUrlUsesFileAsBackup() {
|
||||
whenever(client.insert(isA(), isA())).thenReturn(contentUri)
|
||||
val contribution = createContribution(true, null, null, null, "filePath")
|
||||
|
||||
testObject.save(contribution)
|
||||
|
||||
assertEquals(contentUri, contribution.contentUri)
|
||||
verify(client).insert(eq(BASE_URI), captor.capture())
|
||||
captor.firstValue.let {
|
||||
// Nullable fields are absent if null
|
||||
assertFalse(it.containsKey(Table.COLUMN_LOCAL_URI))
|
||||
assertFalse(it.containsKey(Table.COLUMN_UPLOADED))
|
||||
assertEquals(Utils.makeThumbBaseUrl("filePath"), it.getAsString(Table.COLUMN_IMAGE_URL))
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
fun saveNewContribution_nullableFieldsAreNonNull() {
|
||||
whenever(client.insert(isA(), isA())).thenReturn(contentUri)
|
||||
|
|
|
|||
|
|
@ -10,8 +10,7 @@ import org.junit.Test
|
|||
import org.mockito.ArgumentMatchers
|
||||
import org.mockito.InjectMocks
|
||||
import org.mockito.Mock
|
||||
import org.mockito.Mockito.`when`
|
||||
import org.mockito.Mockito.mock
|
||||
import org.mockito.Mockito.*
|
||||
import org.mockito.MockitoAnnotations
|
||||
import org.wikipedia.dataclient.mwapi.MwQueryPage
|
||||
import org.wikipedia.dataclient.mwapi.RecentChange
|
||||
|
|
@ -51,6 +50,10 @@ class ReviewHelperTest {
|
|||
|
||||
`when`(mediaWikiApi?.pageExists(ArgumentMatchers.anyString()))
|
||||
.thenReturn(Single.just(false))
|
||||
`when`(okHttpJsonApiClient?.getMedia(ArgumentMatchers.anyString(), ArgumentMatchers.anyBoolean()))
|
||||
.thenReturn(Single.just(mock(Media::class.java)))
|
||||
|
||||
|
||||
val randomMedia = reviewHelper?.randomMedia?.blockingGet()
|
||||
|
||||
assertTrue(randomMedia is Media)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue