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 tobiasKaminsky
parent 4166fca88e
commit a4a701f9f8
No known key found for this signature in database
GPG Key ID: 0E00D4D47D0C5AF7
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)
}