Fix tests

Signed-off-by: alperozturk <alper_ozturk@proton.me>
This commit is contained in:
alperozturk 2024-02-20 15:47:38 +01:00 committed by Alper Öztürk
parent b555cb7a81
commit 89770f0de2
2 changed files with 7 additions and 1 deletions

View file

@ -5,11 +5,14 @@ import androidx.test.core.app.launchActivity
import com.nextcloud.client.jobs.upload.FileUploadWorker
import com.nextcloud.test.TestActivity
import com.owncloud.android.AbstractIT
import com.owncloud.android.lib.common.utils.Log_OC
import org.junit.Assert
import org.junit.Test
class UriUploaderIT : AbstractIT() {
private val tag = "UriUploaderIT"
@Test
fun testUploadPrivatePathSharedPreferences() {
launchActivity<TestActivity>().use { scenario ->
@ -43,6 +46,9 @@ class UriUploaderIT : AbstractIT() {
null
)
val uploadResult = sut.uploadUris()
Log_OC.d(tag, "Upload Result: ${uploadResult.name}")
Assert.assertEquals(
"Wrong result code",
UriUploader.UriUploaderResultCode.ERROR_SENSITIVE_PATH,

View file

@ -115,7 +115,7 @@ class UriUploader(
private fun belongsToCurrentApplication(ctx: Context, uri: Uri): Boolean {
val authority: String = uri.authority.toString()
val info: ProviderInfo = ctx.packageManager.resolveContentProvider(authority, 0) ?: return false
val info: ProviderInfo = ctx.packageManager.resolveContentProvider(authority, 0) ?: return true
return ctx.packageName.equals(info.packageName)
}