use of com.fsck.k9.mail.BodyPart in project k-9 by k9mail.
the class MessageCryptoStructureDetectorTest 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 = MessageCryptoStructureDetector.findPrimaryEncryptedOrSignedPart(message, outputExtraParts);
assertSame(pgpInlinePart, cryptoPart);
}
use of com.fsck.k9.mail.BodyPart in project k-9 by k9mail.
the class MessageCryptoStructureDetectorTest method findPrimaryCryptoPart_withMultipartMixedContainingPgpInline.
@Test
public void findPrimaryCryptoPart_withMultipartMixedContainingPgpInline() throws Exception {
List<Part> outputExtraParts = new ArrayList<>();
BodyPart pgpInlinePart = bodypart("text/plain", PGP_INLINE_DATA);
Message message = messageFromBody(multipart("mixed", pgpInlinePart, bodypart("application/octet-stream")));
Part cryptoPart = MessageCryptoStructureDetector.findPrimaryEncryptedOrSignedPart(message, outputExtraParts);
assertSame(pgpInlinePart, cryptoPart);
}
use of com.fsck.k9.mail.BodyPart in project k-9 by k9mail.
the class MessageCryptoStructureDetectorTest method findEncrypted__withBadProtocolAndNoBody__shouldReturnRoot.
@Test
public void findEncrypted__withBadProtocolAndNoBody__shouldReturnRoot() throws Exception {
Message message = messageFromBody(multipart("encrypted", bodypart("application/pgp-encrypted"), bodypart("application/octet-stream")));
List<Part> encryptedParts = MessageCryptoStructureDetector.findMultipartEncryptedParts(message);
assertEquals(1, encryptedParts.size());
assertSame(message, encryptedParts.get(0));
}
use of com.fsck.k9.mail.BodyPart in project k-9 by k9mail.
the class MessageCryptoStructureDetectorTest method findSigned__withNoProtocolAndNoBody__shouldReturnRoot.
@Test
public void findSigned__withNoProtocolAndNoBody__shouldReturnRoot() throws Exception {
Message message = messageFromBody(multipart("signed", bodypart("text/plain"), bodypart("application/pgp-signature")));
List<Part> signedParts = MessageCryptoStructureDetector.findMultipartSignedParts(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 MessageCryptoStructureDetectorTest method findEncrypted__withEmptyProtocol__shouldReturnEmpty.
@Test
public void findEncrypted__withEmptyProtocol__shouldReturnEmpty() throws Exception {
Message message = messageFromBody(multipart("encrypted", bodypart("application/pgp-encrypted"), bodypart("application/octet-stream", "content")));
List<Part> encryptedParts = MessageCryptoStructureDetector.findMultipartEncryptedParts(message);
assertTrue(encryptedParts.isEmpty());
}
Aggregations