aboutsummaryrefslogtreecommitdiffstats
path: root/OpenKeychain/src/test
diff options
context:
space:
mode:
authorVincent Breitmoser <valodim@mugenguild.com>2016-02-23 14:55:23 +0100
committerVincent Breitmoser <valodim@mugenguild.com>2016-02-23 15:01:22 +0100
commit03e695c6509ee6ada0ad6a0a21181277ba298c34 (patch)
tree6b697636d7e065e4bf15e567059f200ff250419a /OpenKeychain/src/test
parent8714a5eac42449dc3584a6bc14a7404c6a4686b5 (diff)
downloadopen-keychain-03e695c6509ee6ada0ad6a0a21181277ba298c34.tar.gz
open-keychain-03e695c6509ee6ada0ad6a0a21181277ba298c34.tar.bz2
open-keychain-03e695c6509ee6ada0ad6a0a21181277ba298c34.zip
ditch isLikelyText flag, set mimeType to text/plain in that case
Diffstat (limited to 'OpenKeychain/src/test')
-rw-r--r--OpenKeychain/src/test/java/org/sufficientlysecure/keychain/pgp/InputDataOperationTest.java6
-rw-r--r--OpenKeychain/src/test/java/org/sufficientlysecure/keychain/util/CharsetVerifierTest.java5
2 files changed, 5 insertions, 6 deletions
diff --git a/OpenKeychain/src/test/java/org/sufficientlysecure/keychain/pgp/InputDataOperationTest.java b/OpenKeychain/src/test/java/org/sufficientlysecure/keychain/pgp/InputDataOperationTest.java
index 013465c44..fba8be061 100644
--- a/OpenKeychain/src/test/java/org/sufficientlysecure/keychain/pgp/InputDataOperationTest.java
+++ b/OpenKeychain/src/test/java/org/sufficientlysecure/keychain/pgp/InputDataOperationTest.java
@@ -162,7 +162,6 @@ public class InputDataOperationTest {
OpenPgpMetadata metadata = result.mMetadata.get(0);
Assert.assertEquals("text/plain", metadata.getMimeType());
Assert.assertEquals("utf-8", metadata.getCharset());
- Assert.assertTrue("data should be looksLikeText", metadata.isLooksLikeText());
metadata = result.mMetadata.get(1);
Assert.assertEquals("text/testvalue", metadata.getMimeType());
@@ -214,7 +213,6 @@ public class InputDataOperationTest {
OpenPgpMetadata metadata = result.mMetadata.get(0);
Assert.assertEquals("text/plain", metadata.getMimeType());
- Assert.assertTrue("data should be looksLikeText", metadata.isLooksLikeText());
Assert.assertNull("charset was bad so it should not be set", metadata.getCharset());
Assert.assertTrue("faulty charset should have been detected",
@@ -236,7 +234,6 @@ public class InputDataOperationTest {
OpenPgpMetadata metadata = result.mMetadata.get(0);
Assert.assertEquals("text/plain", metadata.getMimeType());
- Assert.assertTrue("data should be looksLikeText", metadata.isLooksLikeText());
Assert.assertEquals("charset should be set since it was guessed and not faulty",
"utf-8", metadata.getCharset());
@@ -258,8 +255,7 @@ public class InputDataOperationTest {
Assert.assertNull(result.mDecryptVerifyResult);
OpenPgpMetadata metadata = result.mMetadata.get(0);
- Assert.assertEquals("application/octet-stream", metadata.getMimeType());
- Assert.assertTrue("data should be looksLikeText", metadata.isLooksLikeText());
+ Assert.assertEquals("text/plain", metadata.getMimeType());
Assert.assertEquals("charset should be set since it was guessed and not faulty",
"utf-8", metadata.getCharset());
diff --git a/OpenKeychain/src/test/java/org/sufficientlysecure/keychain/util/CharsetVerifierTest.java b/OpenKeychain/src/test/java/org/sufficientlysecure/keychain/util/CharsetVerifierTest.java
index 8ad6a021f..a87c1595e 100644
--- a/OpenKeychain/src/test/java/org/sufficientlysecure/keychain/util/CharsetVerifierTest.java
+++ b/OpenKeychain/src/test/java/org/sufficientlysecure/keychain/util/CharsetVerifierTest.java
@@ -34,13 +34,14 @@ public class CharsetVerifierTest {
bytes[4] = (byte) 0xc3;
bytes[5] = (byte) 0x28;
- CharsetVerifier charsetVerifier = new CharsetVerifier(bytes, "text/plain", "utf-8");
+ CharsetVerifier charsetVerifier = new CharsetVerifier(bytes, "text/something", "utf-8");
charsetVerifier.readBytesFromBuffer(0, bytes.length);
assertFalse("text/plain should not be marked as binary, even if it is", charsetVerifier.isDefinitelyBinary());
assertTrue("text/plain should be marked as text, even if it isn't valid", charsetVerifier.isProbablyText());
assertTrue("encoding contained illegal chars, so it should be marked as faulty", charsetVerifier.isCharsetFaulty());
assertFalse("charset was specified and should not be marked as guessed", charsetVerifier.isCharsetGuessed());
+ assertEquals("mimetype should be preserved", "text/something", charsetVerifier.getGuessedMimeType());
assertEquals("charset should be utf-8 since it was given explicitly", "utf-8", charsetVerifier.getCharset());
assertEquals("charset should be utf-8 since it was given explicitly", "utf-8", charsetVerifier.getMaybeFaultyCharset());
}
@@ -59,6 +60,7 @@ public class CharsetVerifierTest {
assertTrue("encoding contained illegal chars, so it should be marked as faulty", charsetVerifier.isCharsetFaulty());
assertTrue("charset was guessed and should be marked as such", charsetVerifier.isCharsetGuessed());
assertNull("charset should be null since the guess was faulty", charsetVerifier.getCharset());
+ assertEquals("mimetype should be set to text", "text/plain", charsetVerifier.getGuessedMimeType());
assertEquals("maybe-faulty charset should be utf-8", "utf-8", charsetVerifier.getMaybeFaultyCharset());
}
@@ -73,6 +75,7 @@ public class CharsetVerifierTest {
assertTrue("application/octet-stream with text content should be probably text", charsetVerifier.isProbablyText());
assertFalse("detected charset should not be faulty", charsetVerifier.isCharsetFaulty());
assertTrue("charset was guessed and should be marked as such", charsetVerifier.isCharsetGuessed());
+ assertEquals("mimetype should be set to text", "text/plain", charsetVerifier.getGuessedMimeType());
assertEquals("guessed charset is utf-8", "utf-8", charsetVerifier.getCharset());
}