Make existing tests buildable again
This commit is contained in:
parent
db2743289d
commit
b633cc1f3d
2 changed files with 36 additions and 6 deletions
|
@ -8,6 +8,8 @@ import android.annotation.SuppressLint
|
|||
import android.content.ClipboardManager
|
||||
import android.content.Context
|
||||
import android.content.Intent
|
||||
import android.os.IBinder
|
||||
import android.os.ParcelFileDescriptor
|
||||
import android.os.SystemClock
|
||||
import android.util.Log
|
||||
import androidx.test.ext.junit.runners.AndroidJUnit4
|
||||
|
@ -31,6 +33,7 @@ import org.junit.Assert.assertNotNull
|
|||
import org.junit.Rule
|
||||
import org.junit.Test
|
||||
import org.junit.runner.RunWith
|
||||
import org.openintents.openpgp.IOpenPgpService2
|
||||
|
||||
@RunWith(AndroidJUnit4::class)
|
||||
@LargeTest
|
||||
|
@ -109,7 +112,19 @@ class DecryptTest {
|
|||
// second set the new timer
|
||||
activity.settings.edit().putString("general_show_time", "2").commit()
|
||||
|
||||
activity.onBound(null)
|
||||
activity.onBound(object : IOpenPgpService2 {
|
||||
override fun createOutputPipe(p0: Int): ParcelFileDescriptor {
|
||||
TODO("Not yet implemented")
|
||||
}
|
||||
|
||||
override fun asBinder(): IBinder {
|
||||
TODO("Not yet implemented")
|
||||
}
|
||||
|
||||
override fun execute(p0: Intent?, p1: ParcelFileDescriptor?, p2: Int): Intent {
|
||||
TODO("Not yet implemented")
|
||||
}
|
||||
})
|
||||
|
||||
// have we decrypted things correctly?
|
||||
assertEquals(passEntry.password, activity.crypto_password_show.text)
|
||||
|
@ -118,14 +133,14 @@ class DecryptTest {
|
|||
|
||||
// did we copy the password?
|
||||
val clipboard: ClipboardManager = activity.getSystemService(Context.CLIPBOARD_SERVICE) as ClipboardManager
|
||||
assertEquals(passEntry.password, clipboard.primaryClip.getItemAt(0).text)
|
||||
assertEquals(passEntry.password, clipboard.primaryClip!!.getItemAt(0).text)
|
||||
|
||||
// wait until the clipboard is cleared
|
||||
SystemClock.sleep(4000)
|
||||
|
||||
// The clipboard should be cleared!!
|
||||
for (i in 0..clipboard.primaryClip.itemCount) {
|
||||
assertEquals("", clipboard.primaryClip.getItemAt(i).text)
|
||||
for (i in 0..clipboard.primaryClip!!.itemCount) {
|
||||
assertEquals("", clipboard.primaryClip!!.getItemAt(i).text)
|
||||
}
|
||||
|
||||
// set back the timer
|
||||
|
@ -145,7 +160,7 @@ class DecryptTest {
|
|||
val destPath = "$destination/$filename"
|
||||
val sourcePath = "$source/$filename"
|
||||
|
||||
if (assetManager.list(sourcePath).isNotEmpty()) {
|
||||
if (assetManager.list(sourcePath)!!.isNotEmpty()) {
|
||||
FileUtils.forceMkdir(File(destination, filename))
|
||||
copyAssets("$source/$filename", destPath)
|
||||
} else {
|
||||
|
|
|
@ -7,6 +7,8 @@ package com.zeapo.pwdstore
|
|||
import android.annotation.SuppressLint
|
||||
import android.content.Context
|
||||
import android.content.Intent
|
||||
import android.os.IBinder
|
||||
import android.os.ParcelFileDescriptor
|
||||
import androidx.test.espresso.Espresso.onView
|
||||
import androidx.test.espresso.action.ViewActions.click
|
||||
import androidx.test.espresso.action.ViewActions.scrollTo
|
||||
|
@ -25,6 +27,7 @@ import org.apache.commons.io.IOUtils
|
|||
import org.junit.Rule
|
||||
import org.junit.Test
|
||||
import org.junit.runner.RunWith
|
||||
import org.openintents.openpgp.IOpenPgpService2
|
||||
|
||||
@RunWith(AndroidJUnit4::class)
|
||||
@LargeTest
|
||||
|
@ -67,7 +70,19 @@ class EncryptTest {
|
|||
init()
|
||||
|
||||
onView(withId(R.id.crypto_password_category)).check(ViewAssertions.matches(withText(parentPath)))
|
||||
activity.onBound(null)
|
||||
activity.onBound(object : IOpenPgpService2 {
|
||||
override fun createOutputPipe(p0: Int): ParcelFileDescriptor {
|
||||
TODO("Not yet implemented")
|
||||
}
|
||||
|
||||
override fun asBinder(): IBinder {
|
||||
TODO("Not yet implemented")
|
||||
}
|
||||
|
||||
override fun execute(p0: Intent?, p1: ParcelFileDescriptor?, p2: Int): Intent {
|
||||
TODO("Not yet implemented")
|
||||
}
|
||||
})
|
||||
val clearPass = IOUtils.toString(testContext.assets.open("clear-store/category/sub"), Charsets.UTF_8.name())
|
||||
val passEntry = PasswordEntry(clearPass)
|
||||
|
||||
|
|
Loading…
Reference in a new issue