diff options
author | Vincent Breitmoser <valodim@mugenguild.com> | 2014-07-09 15:53:18 +0200 |
---|---|---|
committer | Vincent Breitmoser <valodim@mugenguild.com> | 2014-07-09 16:03:30 +0200 |
commit | 718acbf954b1318c6a90ba0f9c79e63f398fb498 (patch) | |
tree | c5c99374ed368d07348d17212527c4e86297f061 /OpenKeychain-Test/src/test/java/org/sufficientlysecure/keychain/tests/PgpDecryptVerifyTest.java | |
parent | 9320d2d8a204496ace8f973a59594ccd698a2170 (diff) | |
download | open-keychain-718acbf954b1318c6a90ba0f9c79e63f398fb498.tar.gz open-keychain-718acbf954b1318c6a90ba0f9c79e63f398fb498.tar.bz2 open-keychain-718acbf954b1318c6a90ba0f9c79e63f398fb498.zip |
put unit tests into external module (CAVEAT)
this requires a more up to date version of gradle-android-test-plugin
than is currently in the repositories. it must be added to the local
maven repo using ./install-custom-gradle-test-plugin.sh before
compiling.
Diffstat (limited to 'OpenKeychain-Test/src/test/java/org/sufficientlysecure/keychain/tests/PgpDecryptVerifyTest.java')
-rw-r--r-- | OpenKeychain-Test/src/test/java/org/sufficientlysecure/keychain/tests/PgpDecryptVerifyTest.java | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/OpenKeychain-Test/src/test/java/org/sufficientlysecure/keychain/tests/PgpDecryptVerifyTest.java b/OpenKeychain-Test/src/test/java/org/sufficientlysecure/keychain/tests/PgpDecryptVerifyTest.java new file mode 100644 index 000000000..bc78f540c --- /dev/null +++ b/OpenKeychain-Test/src/test/java/org/sufficientlysecure/keychain/tests/PgpDecryptVerifyTest.java @@ -0,0 +1,36 @@ +package org.sufficientlysecure.keychain.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); + } + +} |