mirror of
https://github.com/commons-app/apps-android-commons.git
synced 2025-11-05 09:13:55 +01:00
Code cleanup and convert the upload contract to kotlin
This commit is contained in:
parent
c3b4297cff
commit
5cbc2ad757
5 changed files with 150 additions and 158 deletions
|
|
@ -5,7 +5,6 @@ import android.content.Intent
|
|||
import androidx.test.core.app.ApplicationProvider
|
||||
import androidx.work.Configuration
|
||||
import androidx.work.testing.WorkManagerTestInitHelper
|
||||
import fr.free.nrw.commons.CommonsApplication
|
||||
import fr.free.nrw.commons.OkHttpConnectionFactory
|
||||
import fr.free.nrw.commons.R
|
||||
import fr.free.nrw.commons.TestCommonsApplication
|
||||
|
|
@ -75,7 +74,7 @@ class UploadActivityUnitTests {
|
|||
@Test
|
||||
@Throws(Exception::class)
|
||||
fun testIsLoggedIn() {
|
||||
activity.isLoggedIn
|
||||
activity.isLoggedIn()
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
@ -139,7 +138,7 @@ class UploadActivityUnitTests {
|
|||
@Test
|
||||
@Throws(Exception::class)
|
||||
fun testGetUploadableFiles() {
|
||||
activity.uploadableFiles
|
||||
activity.getUploadableFiles()
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
|
|||
|
|
@ -61,7 +61,7 @@ class UploadPresenterTest {
|
|||
uploadPresenter.onAttachView(view)
|
||||
`when`(repository.buildContributions()).thenReturn(Observable.just(contribution))
|
||||
uploadableFiles.add(uploadableFile)
|
||||
`when`(view.uploadableFiles).thenReturn(uploadableFiles)
|
||||
`when`(view.getUploadableFiles()).thenReturn(uploadableFiles)
|
||||
`when`(uploadableFile.getFilePath()).thenReturn("data://test")
|
||||
}
|
||||
|
||||
|
|
@ -71,9 +71,9 @@ class UploadPresenterTest {
|
|||
@Ignore
|
||||
@Test
|
||||
fun handleSubmitTestUserLoggedIn() {
|
||||
`when`(view.isLoggedIn).thenReturn(true)
|
||||
`when`(view.isLoggedIn()).thenReturn(true)
|
||||
uploadPresenter.handleSubmit()
|
||||
verify(view).isLoggedIn
|
||||
verify(view).isLoggedIn()
|
||||
verify(view).showProgress(true)
|
||||
verify(repository).buildContributions()
|
||||
verify(repository).buildContributions()
|
||||
|
|
@ -130,9 +130,9 @@ class UploadPresenterTest {
|
|||
false,
|
||||
),
|
||||
).thenReturn(true)
|
||||
`when`(view.isLoggedIn).thenReturn(true)
|
||||
`when`(view.isLoggedIn()).thenReturn(true)
|
||||
uploadPresenter.handleSubmit()
|
||||
verify(view).isLoggedIn
|
||||
verify(view).isLoggedIn()
|
||||
verify(view).showProgress(true)
|
||||
verify(repository).buildContributions()
|
||||
verify(repository).buildContributions()
|
||||
|
|
@ -144,9 +144,9 @@ class UploadPresenterTest {
|
|||
@Ignore
|
||||
@Test
|
||||
fun handleSubmitTestUserNotLoggedIn() {
|
||||
`when`(view.isLoggedIn).thenReturn(false)
|
||||
`when`(view.isLoggedIn()).thenReturn(false)
|
||||
uploadPresenter.handleSubmit()
|
||||
verify(view).isLoggedIn
|
||||
verify(view).isLoggedIn()
|
||||
verify(view).askUserToLogIn()
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue