diff options
author | Vincent Breitmoser <valodim@mugenguild.com> | 2014-06-22 13:42:03 +0200 |
---|---|---|
committer | Vincent Breitmoser <valodim@mugenguild.com> | 2014-06-22 13:42:03 +0200 |
commit | 002a391a68688bf1b9a81cc8c667964cd0fe5d71 (patch) | |
tree | ccfccdbb08ca1e8b1b1a8aa7e85a6c8c6cc8d586 /OpenKeychain/src/test/java/tests/PgpDecryptVerifyTest.java | |
parent | 22ea9c60475b20819a29b535b772b699526d0146 (diff) | |
parent | 012b895e4f4fce0b3846bc688bb2738bde4f819a (diff) | |
download | open-keychain-002a391a68688bf1b9a81cc8c667964cd0fe5d71.tar.gz open-keychain-002a391a68688bf1b9a81cc8c667964cd0fe5d71.tar.bz2 open-keychain-002a391a68688bf1b9a81cc8c667964cd0fe5d71.zip |
Merge remote-tracking branch 'origin/master'
Diffstat (limited to 'OpenKeychain/src/test/java/tests/PgpDecryptVerifyTest.java')
-rw-r--r-- | OpenKeychain/src/test/java/tests/PgpDecryptVerifyTest.java | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/OpenKeychain/src/test/java/tests/PgpDecryptVerifyTest.java b/OpenKeychain/src/test/java/tests/PgpDecryptVerifyTest.java new file mode 100644 index 000000000..346a1f9df --- /dev/null +++ b/OpenKeychain/src/test/java/tests/PgpDecryptVerifyTest.java @@ -0,0 +1,37 @@ +package tests; + +import org.junit.Assert; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.robolectric.*; +import org.openintents.openpgp.OpenPgpSignatureResult; +import org.sufficientlysecure.keychain.testsupport.PgpVerifyTestingHelper; + +@RunWith(RobolectricTestRunner.class) +@org.robolectric.annotation.Config(emulateSdk = 18) // Robolectric doesn't yet support 19 +public class PgpDecryptVerifyTest { + + @Test + public void testVerifySuccess() throws Exception { + + String testFileName = "/sample.txt"; + int expectedSignatureResult = OpenPgpSignatureResult.SIGNATURE_SUCCESS_UNCERTIFIED; + + int status = new PgpVerifyTestingHelper(Robolectric.application).doTestFile(testFileName); + + Assert.assertEquals(expectedSignatureResult, status); + } + + + @Test + public void testVerifyFailure() throws Exception { + + String testFileName = "/sample-altered.txt"; + int expectedSignatureResult = OpenPgpSignatureResult.SIGNATURE_ERROR; + + int status = new PgpVerifyTestingHelper(Robolectric.application).doTestFile(testFileName); + + Assert.assertEquals(expectedSignatureResult, status); + } + +} |