aboutsummaryrefslogtreecommitdiff
path: root/app/src/androidTest
diff options
context:
space:
mode:
authorFabian Henneke <fabian@henneke.me>2020-04-15 17:11:09 +0200
committerHarsh Shandilya <me@msfjarvis.dev>2020-04-15 22:47:41 +0530
commitb633cc1f3dc9acf2e2a2cc11a540375a9d85390b (patch)
tree30eb3c1bef4b144312e2bd4045476c97aef532d4 /app/src/androidTest
parentdb2743289d9f4423bee5a6d357c4c73c566db9d2 (diff)
Make existing tests buildable again
Diffstat (limited to 'app/src/androidTest')
-rw-r--r--app/src/androidTest/java/com/zeapo/pwdstore/DecryptTest.kt25
-rw-r--r--app/src/androidTest/java/com/zeapo/pwdstore/EncryptTest.kt17
2 files changed, 36 insertions, 6 deletions
diff --git a/app/src/androidTest/java/com/zeapo/pwdstore/DecryptTest.kt b/app/src/androidTest/java/com/zeapo/pwdstore/DecryptTest.kt
index 6a13e810..17c7cbed 100644
--- a/app/src/androidTest/java/com/zeapo/pwdstore/DecryptTest.kt
+++ b/app/src/androidTest/java/com/zeapo/pwdstore/DecryptTest.kt
@@ -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 {
diff --git a/app/src/androidTest/java/com/zeapo/pwdstore/EncryptTest.kt b/app/src/androidTest/java/com/zeapo/pwdstore/EncryptTest.kt
index ecf58389..ba63ce1a 100644
--- a/app/src/androidTest/java/com/zeapo/pwdstore/EncryptTest.kt
+++ b/app/src/androidTest/java/com/zeapo/pwdstore/EncryptTest.kt
@@ -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)