use of com.fsck.k9.mail.BodyPart in project k-9 by k9mail.
the class MessageDecryptVerifierTest method findSigned__withSimpleMultipartSigned__shouldReturnRoot.
@Test
public void findSigned__withSimpleMultipartSigned__shouldReturnRoot() throws Exception {
Message message = messageFromBody(multipart("signed", bodypart("text/plain"), bodypart("application/pgp-signature")));
List<Part> signedParts = MessageDecryptVerifier.findSignedParts(message, messageCryptoAnnotations);
assertEquals(1, signedParts.size());
assertSame(message, signedParts.get(0));
}
use of com.fsck.k9.mail.BodyPart in project k-9 by k9mail.
the class MessageDecryptVerifierTest method findEncrypted__withMultipartMixedSubEncrypted__shouldReturnRoot.
@Test
public void findEncrypted__withMultipartMixedSubEncrypted__shouldReturnRoot() throws Exception {
Message message = messageFromBody(multipart("mixed", multipart("encrypted", bodypart("application/pgp-encrypted"), bodypart("application/octet-stream"))));
List<Part> encryptedParts = MessageDecryptVerifier.findEncryptedParts(message);
assertEquals(1, encryptedParts.size());
assertSame(getPart(message, 0), encryptedParts.get(0));
}
use of com.fsck.k9.mail.BodyPart in project k-9 by k9mail.
the class MessageDecryptVerifierTest method findSigned__withComplexMultipartSigned__shouldReturnRoot.
@Test
public void findSigned__withComplexMultipartSigned__shouldReturnRoot() throws Exception {
Message message = messageFromBody(multipart("signed", multipart("mixed", bodypart("text/plain"), bodypart("application/pdf")), bodypart("application/pgp-signature")));
List<Part> signedParts = MessageDecryptVerifier.findSignedParts(message, messageCryptoAnnotations);
assertEquals(1, signedParts.size());
assertSame(message, signedParts.get(0));
}
use of com.fsck.k9.mail.BodyPart in project k-9 by k9mail.
the class MessageDecryptVerifierTest method multipart.
MimeBodyPart multipart(String type, BodyPart... subParts) throws MessagingException {
MimeMultipart multiPart = MimeMultipart.newInstance();
multiPart.setSubType(type);
for (BodyPart subPart : subParts) {
multiPart.addBodyPart(subPart);
}
return new MimeBodyPart(multiPart);
}
use of com.fsck.k9.mail.BodyPart in project k-9 by k9mail.
the class MessageDecryptVerifierTest method findPrimaryCryptoPart_withMultipartAlternativeContainingPgpInline.
@Test
public void findPrimaryCryptoPart_withMultipartAlternativeContainingPgpInline() throws Exception {
List<Part> outputExtraParts = new ArrayList<>();
BodyPart pgpInlinePart = bodypart("text/plain", PGP_INLINE_DATA);
Message message = messageFromBody(multipart("alternative", pgpInlinePart, bodypart("text/html")));
Part cryptoPart = MessageDecryptVerifier.findPrimaryEncryptedOrSignedPart(message, outputExtraParts);
assertSame(pgpInlinePart, cryptoPart);
}
Aggregations