use of com.fsck.k9.mail.Multipart in project k-9 by k9mail.
the class MessageDecryptVerifierTest method findEncrypted__withMultipartMixedSubSignedAndText__shouldReturnSigned.
@Test
public void findEncrypted__withMultipartMixedSubSignedAndText__shouldReturnSigned() throws Exception {
Message message = messageFromBody(multipart("mixed", multipart("signed", bodypart("text/plain"), bodypart("application/pgp-signature")), bodypart("text/plain")));
List<Part> signedParts = MessageDecryptVerifier.findSignedParts(message, messageCryptoAnnotations);
assertEquals(1, signedParts.size());
assertSame(getPart(message, 0), signedParts.get(0));
}
use of com.fsck.k9.mail.Multipart in project k-9 by k9mail.
the class MessageDecryptVerifierTest method findEncrypted__withMultipartMixedSubEncryptedAndEncrypted__shouldReturnBoth.
@Test
public void findEncrypted__withMultipartMixedSubEncryptedAndEncrypted__shouldReturnBoth() throws Exception {
Message message = messageFromBody(multipart("mixed", multipart("encrypted", bodypart("application/pgp-encrypted"), bodypart("application/octet-stream")), multipart("encrypted", bodypart("application/pgp-encrypted"), bodypart("application/octet-stream"))));
List<Part> encryptedParts = MessageDecryptVerifier.findEncryptedParts(message);
assertEquals(2, encryptedParts.size());
assertSame(getPart(message, 0), encryptedParts.get(0));
assertSame(getPart(message, 1), encryptedParts.get(1));
}
use of com.fsck.k9.mail.Multipart in project k-9 by k9mail.
the class MessageDecryptVerifierTest method findEncrypted__withMultipartMixedSubTextAndEncrypted__shouldReturnEncrypted.
@Test
public void findEncrypted__withMultipartMixedSubTextAndEncrypted__shouldReturnEncrypted() throws Exception {
Message message = messageFromBody(multipart("mixed", bodypart("text/plain"), multipart("encrypted", bodypart("application/pgp-encrypted"), bodypart("application/octet-stream"))));
List<Part> encryptedParts = MessageDecryptVerifier.findEncryptedParts(message);
assertEquals(1, encryptedParts.size());
assertSame(getPart(message, 1), encryptedParts.get(0));
}
use of com.fsck.k9.mail.Multipart in project k-9 by k9mail.
the class MessageDecryptVerifierTest method findEncrypted__withMultipartEncrypted__shouldReturnRoot.
@Test
public void findEncrypted__withMultipartEncrypted__shouldReturnRoot() throws Exception {
Message message = messageFromBody(multipart("encrypted", bodypart("application/pgp-encrypted"), bodypart("application/octet-stream")));
List<Part> encryptedParts = MessageDecryptVerifier.findEncryptedParts(message);
assertEquals(1, encryptedParts.size());
assertSame(message, encryptedParts.get(0));
}
use of com.fsck.k9.mail.Multipart in project k-9 by k9mail.
the class EncryptionDetectorTest method isEncrypted_withMultipartMixedContainingSMimePart_shouldReturnTrue.
@Test
public void isEncrypted_withMultipartMixedContainingSMimePart_shouldReturnTrue() throws Exception {
Message message = createMultipartMessage("multipart/mixed", createPart("application/pkcs7-mime"), createPart("text/plain"));
boolean encrypted = encryptionDetector.isEncrypted(message);
assertTrue(encrypted);
}
Aggregations