Browse Source

fix the test suite after incompatible API changes

ENGINE-959
Luca Saiu 4 weeks ago
parent
commit
0a36edc769
32 changed files with 191 additions and 279 deletions
  1. +4
    -5
      test/src/AppleMailTest.cc
  2. +1
    -2
      test/src/AsciiBinaryAtt998Test.cc
  3. +8
    -8
      test/src/CheckRenewedExpiredKeyTrustStatusTest.cc
  4. +2
    -3
      test/src/DecryptAttachPrivateKeyTrustedTest.cc
  5. +1
    -2
      test/src/DecryptAttachPrivateKeyUntrustedTest.cc
  6. +2
    -4
      test/src/ElevatedAttachmentsTest.cc
  7. +10
    -8
      test/src/EncryptForIdentityTest.cc
  8. +7
    -7
      test/src/Engine463Test.cc
  9. +1
    -2
      test/src/Engine514Test.cc
  10. +1
    -2
      test/src/Engine619Test.cc
  11. +1
    -2
      test/src/Engine655Test.cc
  12. +1
    -2
      test/src/Engine704Test.cc
  13. +4
    -3
      test/src/ExternalRevokeTest.cc
  14. +34
    -59
      test/src/GroupEncryptionTest.cc
  15. +3
    -3
      test/src/HeaderKeyImportTest.cc
  16. +18
    -36
      test/src/KeyAttachmentTest.cc
  17. +16
    -26
      test/src/KeyResetMessageTest.cc
  18. +2
    -2
      test/src/LeastColorGroupTest.cc
  19. +4
    -3
      test/src/LeastCommonDenomColorTest.cc
  20. +2
    -4
      test/src/MessageNullFromTest.cc
  21. +2
    -2
      test/src/MessageTwoPointOhTest.cc
  22. +2
    -4
      test/src/NoOwnIdentWritesOnDecryptTest.cc
  23. +5
    -5
      test/src/OldMessageApiTest.cc
  24. +6
    -12
      test/src/PassphraseTest.cc
  25. +13
    -26
      test/src/PepSubjectReceivedTest.cc
  26. +6
    -4
      test/src/ReceiverRatingTest.cc
  27. +24
    -33
      test/src/ReencryptPlusExtraKeysTest.cc
  28. +1
    -2
      test/src/SenderFPRTest.cc
  29. +6
    -2
      test/src/TestUtilities.cc
  30. +1
    -2
      test/src/URIAddressTest.cc
  31. +1
    -2
      test/src/UnencryptedPepMailTest.cc
  32. +2
    -2
      test/src/VerifyTest.cc

+ 4
- 5
test/src/AppleMailTest.cc View File

@ -120,7 +120,6 @@ TEST_F(AppleMailTest, check_apple_mail_text_signed_encrypted) {
message* msg_ptr = nullptr;
message* dest_msg = nullptr;
stringlist_t* keylist = nullptr;
PEP_rating rating;
PEP_decrypt_flags_t flags = 0;
message* final_ptr = nullptr;
@ -133,14 +132,14 @@ TEST_F(AppleMailTest, check_apple_mail_text_signed_encrypted) {
final_ptr = msg_ptr;
status = decrypt_message(session, msg_ptr, &dest_msg, &keylist, &rating, &flags);
status = decrypt_message(session, msg_ptr, &dest_msg, &keylist, &flags);
final_ptr = dest_msg ? dest_msg : msg_ptr;
output_stream << "shortmsg: " << final_ptr->shortmsg << endl << endl;
output_stream << "longmsg: " << final_ptr->longmsg << endl << endl;
output_stream << "longmsg_formatted: " << (final_ptr->longmsg_formatted ? final_ptr->longmsg_formatted : "(empty)") << endl << endl;
ASSERT_EQ(color_from_rating(rating) , PEP_color_green);
ASSERT_EQ(color_from_rating(final_ptr->rating) , PEP_color_green);
if (final_ptr == dest_msg)
free_message(dest_msg);
@ -194,14 +193,14 @@ TEST_F(AppleMailTest, check_apple_mail_html_signed_encrypted) {
ASSERT_EQ(status, PEP_STATUS_OK);
ASSERT_NOTNULL(msg_ptr);
final_ptr = msg_ptr;
status = decrypt_message(session, msg_ptr, &dest_msg, &keylist, &rating, &flags);
status = decrypt_message(session, msg_ptr, &dest_msg, &keylist, &flags);
final_ptr = dest_msg ? dest_msg : msg_ptr;
output_stream << "shortmsg: " << final_ptr->shortmsg << endl << endl;
output_stream << "longmsg: " << final_ptr->longmsg << endl << endl;
output_stream << "longmsg_formatted: " << (final_ptr->longmsg_formatted ? final_ptr->longmsg_formatted : "(empty)") << endl << endl;
ASSERT_EQ(color_from_rating(rating) , PEP_color_green);
ASSERT_EQ(color_from_rating(final_ptr->rating) , PEP_color_green);
if (final_ptr == dest_msg)
free_message(dest_msg);


+ 1
- 2
test/src/AsciiBinaryAtt998Test.cc View File

@ -163,10 +163,9 @@ TEST_F(AsciiBinary998Test, check_engine_895) {
message* dec_msg = NULL;
enc_msg->dir = PEP_dir_incoming;
stringlist_t* keylist = NULL;
PEP_rating rating;
PEP_decrypt_flags_t flags = 0;
status = decrypt_message(session, enc_msg, &dec_msg, &keylist, &rating, &flags);
status = decrypt_message(session, enc_msg, &dec_msg, &keylist, &flags);
ASSERT_OK;
ASSERT_EQ(memcmp(data_copy, dec_msg->attachments->value, data_size), 0);


+ 8
- 8
test/src/CheckRenewedExpiredKeyTrustStatusTest.cc View File

@ -117,7 +117,6 @@ TEST_F(CheckRenewedExpiredKeyTrustStatusTest, check_renewed_expired_key_trust_st
char* decrypted_msg = NULL;
stringlist_t* keylist = NULL;
PEP_rating rating;
PEP_decrypt_flags_t flags = 0;
message* dec_msg = NULL;
@ -125,7 +124,7 @@ TEST_F(CheckRenewedExpiredKeyTrustStatusTest, check_renewed_expired_key_trust_st
status = mime_decode_message(msg.c_str(), msg.size(), &enc_msg, NULL);
ASSERT_OK;
status = decrypt_message(session, enc_msg, &dec_msg, &keylist, &rating, &flags);
status = decrypt_message(session, enc_msg, &dec_msg, &keylist, &flags);
ASSERT_EQ(status, PEP_DECRYPTED); // ???
ok = slurp_and_import_key(session, "test_keys/pub/inquisitor-0xA4728718_renewed_pub.asc");
@ -140,6 +139,7 @@ TEST_F(CheckRenewedExpiredKeyTrustStatusTest, check_renewed_expired_key_trust_st
msg2->attachments = new_bloblist(NULL, 0, "application/octet-stream", NULL);
// We don't keep OpenPGP expired keys. We'll have to receive the new one via mail.
PEP_rating rating;
status = outgoing_message_rating(session, msg2, &rating);
ASSERT_OK;
ASSERT_EQ(rating, PEP_rating_reliable);
@ -182,7 +182,6 @@ TEST_F(CheckRenewedExpiredKeyTrustStatusTest, check_renewed_expired_key_trust_st
char* decrypted_msg = NULL;
stringlist_t* keylist = NULL;
PEP_rating rating;
PEP_decrypt_flags_t flags = 0;
message* dec_msg = NULL;
@ -190,7 +189,7 @@ TEST_F(CheckRenewedExpiredKeyTrustStatusTest, check_renewed_expired_key_trust_st
status = mime_decode_message(msg.c_str(), msg.size(), &enc_msg, NULL);
ASSERT_OK;
status = decrypt_message(session, enc_msg, &dec_msg, &keylist, &rating, &flags);
status = decrypt_message(session, enc_msg, &dec_msg, &keylist, &flags);
ASSERT_EQ(status, PEP_DECRYPTED); // ???
ok = slurp_and_import_key(session, "test_keys/pub/inquisitor-0xA4728718_renewed_pub.asc");
@ -205,6 +204,7 @@ TEST_F(CheckRenewedExpiredKeyTrustStatusTest, check_renewed_expired_key_trust_st
msg2->attachments = new_bloblist(NULL, 0, "application/octet-stream", NULL);
// We don't keep OpenPGP expired keys. We'll have to receive the new one via mail.
PEP_rating rating;
status = outgoing_message_rating(session, msg2, &rating);
ASSERT_OK;
ASSERT_EQ(rating, PEP_rating_reliable);
@ -273,7 +273,6 @@ TEST_F(CheckRenewedExpiredKeyTrustStatusTest, check_renewed_expired_key_trust_st
stringlist_t* keylist = NULL;
// char* modified_src = NULL;
PEP_rating rating;
PEP_decrypt_flags_t flags = 0;
message* dec_msg = NULL;
@ -281,7 +280,7 @@ TEST_F(CheckRenewedExpiredKeyTrustStatusTest, check_renewed_expired_key_trust_st
status = mime_decode_message(msg.c_str(), msg.size(), &enc_msg, NULL);
ASSERT_OK;
status = decrypt_message(session, enc_msg, &dec_msg, &keylist, &rating, &flags);
status = decrypt_message(session, enc_msg, &dec_msg, &keylist, &flags);
ASSERT_EQ(status, PEP_DECRYPTED); // ???
ok = slurp_and_import_key(session, "test_keys/pub/inquisitor-0xA4728718_renewed_pub.asc");
@ -305,6 +304,7 @@ TEST_F(CheckRenewedExpiredKeyTrustStatusTest, check_renewed_expired_key_trust_st
msg2->longmsg = strdup("Blahblahblah!");
msg2->attachments = new_bloblist(NULL, 0, "application/octet-stream", NULL);
PEP_rating rating;
status = outgoing_message_rating(session, msg2, &rating);
ASSERT_OK;
ASSERT_EQ(rating, PEP_rating_trusted);
@ -347,7 +347,6 @@ TEST_F(CheckRenewedExpiredKeyTrustStatusTest, check_renewed_expired_key_trust_st
char* decrypted_msg = NULL;
stringlist_t* keylist = nullptr;
PEP_rating rating;
PEP_decrypt_flags_t flags = 0;
message* dec_msg = NULL;
@ -355,7 +354,7 @@ TEST_F(CheckRenewedExpiredKeyTrustStatusTest, check_renewed_expired_key_trust_st
status = mime_decode_message(msg.c_str(), msg.size(), &enc_msg, NULL);
ASSERT_OK;
status = decrypt_message(session, enc_msg, &dec_msg, &keylist, &rating, &flags);
status = decrypt_message(session, enc_msg, &dec_msg, &keylist, &flags);
ASSERT_EQ(status, PEP_DECRYPTED);
ok = slurp_and_import_key(session, "test_keys/pub/inquisitor-0xA4728718_renewed_pub.asc");
@ -370,6 +369,7 @@ TEST_F(CheckRenewedExpiredKeyTrustStatusTest, check_renewed_expired_key_trust_st
msg2->longmsg = strdup("Blahblahblah!");
msg2->attachments = new_bloblist(NULL, 0, "application/octet-stream", NULL);
PEP_rating rating;
status = outgoing_message_rating(session, msg2, &rating);
ASSERT_OK;
ASSERT_EQ(rating , PEP_rating_reliable);


+ 2
- 3
test/src/DecryptAttachPrivateKeyTrustedTest.cc View File

@ -156,7 +156,6 @@ TEST_F(DecryptAttachPrivateKeyTrustedTest, check_decrypt_attach_private_key_trus
output_stream << "decrypt with attached private key: Same address, same user_id, trusted" << endl;
message* decrypted_text = NULL;
stringlist_t* keylist_used = NULL;
PEP_rating rating;
PEP_decrypt_flags_t flags = 0;
output_stream << "Trusting own key for " << same_addr_same_uid->user_id << " and " << same_addr_same_uid->fpr << endl;
@ -172,7 +171,7 @@ TEST_F(DecryptAttachPrivateKeyTrustedTest, check_decrypt_attach_private_key_trus
flags = 0;
status = decrypt_message(session, encoded_text, &decrypted_text,
&keylist_used, &rating, &flags);
&keylist_used, &flags);
status = get_trust(session, same_addr_same_uid);
ASSERT_EQ(same_addr_same_uid->comm_type, PEP_ct_pEp);
@ -180,7 +179,7 @@ TEST_F(DecryptAttachPrivateKeyTrustedTest, check_decrypt_attach_private_key_trus
flags = 0;
status = decrypt_message(session, encoded_text, &decrypted_text,
&keylist_used, &rating, &flags);
&keylist_used, &flags);
output_stream << "Status: " << tl_status_string(status) << endl;
ASSERT_EQ(status, PEP_STATUS_OK);


+ 1
- 2
test/src/DecryptAttachPrivateKeyUntrustedTest.cc View File

@ -163,7 +163,6 @@ TEST_F(DecryptAttachPrivateKeyUntrustedTest, check_decrypt_attach_private_key_un
output_stream << "Same address, same user_id, untrusted" << endl;
message* decrypted_text = NULL;
stringlist_t* keylist_used = NULL;
PEP_rating rating;
PEP_decrypt_flags_t flags = 0;
status = get_trust(session, same_addr_same_uid);
@ -178,7 +177,7 @@ TEST_F(DecryptAttachPrivateKeyUntrustedTest, check_decrypt_attach_private_key_un
flags = 0;
status = decrypt_message(session, encoded_text, &decrypted_text,
&keylist_used, &rating, &flags);
&keylist_used, &flags);
status = get_trust(session, same_addr_same_uid);
ASSERT_EQ(same_addr_same_uid->comm_type, PEP_ct_pEp_unconfirmed);


+ 2
- 4
test/src/ElevatedAttachmentsTest.cc View File

@ -268,10 +268,9 @@ TEST_F(ElevatedAttachmentsTest, check_encrypt_decrypt_message) {
message *dec_msg = NULL;
stringlist_t *keylist = NULL;
PEP_rating rating;
PEP_decrypt_flags_t flags = 0;
status = decrypt_message(session, enc_msg, &dec_msg, &keylist, &rating, &flags);
status = decrypt_message(session, enc_msg, &dec_msg, &keylist, &flags);
ASSERT_EQ(status, PEP_STATUS_OK);
ASSERT_STREQ(dec_msg->shortmsg, enc_msg->shortmsg);
ASSERT_STREQ(msg->longmsg, dec_msg->longmsg);
@ -404,10 +403,9 @@ TEST_F(ElevatedAttachmentsTest, check_encrypt_decrypt_message_elevated) {
message *dec_msg = NULL;
stringlist_t *keylist = NULL;
PEP_rating rating;
PEP_decrypt_flags_t flags = 0;
status = decrypt_message(session, art_msg, &dec_msg, &keylist, &rating, &flags);
status = decrypt_message(session, art_msg, &dec_msg, &keylist, &flags);
ASSERT_EQ(status, PEP_STATUS_OK);
ASSERT_TRUE(dec_msg);
// today the engine is sucking keys in


+ 10
- 8
test/src/EncryptForIdentityTest.cc View File

@ -175,12 +175,12 @@ TEST_F(EncryptForIdentityTest, check_encrypt_for_identity) {
message* decrypted_msg = nullptr;
stringlist_t* keylist_used = nullptr;
PEP_rating rating;
PEP_decrypt_flags_t flags;
flags = 0;
status = decrypt_message(session, encrypted_msg, &decrypted_msg, &keylist_used, &rating, &flags);
status = decrypt_message(session, encrypted_msg, &decrypted_msg, &keylist_used, &flags);
ASSERT_NOTNULL(decrypted_msg);
PEP_rating rating = decrypted_msg->rating;
ASSERT_NOTNULL(keylist_used);
ASSERT_NE(rating, 0);
ASSERT_TRUE(status == PEP_DECRYPTED && rating == PEP_rating_unreliable);
@ -226,8 +226,9 @@ TEST_F(EncryptForIdentityTest, check_encrypt_for_identity) {
output_stream << "message encrypted.\n";
flags = 0;
status = decrypt_message(session, encrypted_msg, &decrypted_msg, &keylist_used, &rating, &flags);
status = decrypt_message(session, encrypted_msg, &decrypted_msg, &keylist_used, &flags);
ASSERT_NOTNULL(decrypted_msg);
rating = decrypted_msg->rating;
ASSERT_NOTNULL(keylist_used);
ASSERT_NE(rating, 0);
ASSERT_TRUE(status == PEP_DECRYPTED && rating == PEP_rating_unreliable);
@ -311,12 +312,12 @@ TEST_F(EncryptForIdentityTest, check_encrypt_for_identity) {
free_stringlist(keylist_used);
keylist_used = nullptr;
PEP_decrypt_flags_t mimeflags;
PEP_rating mimerating;
mimeflags = 0;
status = decrypt_message(session, enc_msg, &dec_msg, &keylist_used, &mimerating, &mimeflags);
status = decrypt_message(session, enc_msg, &dec_msg, &keylist_used, &mimeflags);
ASSERT_NOTNULL(dec_msg);
PEP_rating mimerating = dec_msg->rating;
ASSERT_NOTNULL(keylist_used);
ASSERT_NE(mimerating, 0);
@ -434,12 +435,12 @@ TEST_F(EncryptForIdentityTest, check_encrypt_for_identity_with_URI) {
message* decrypted_msg = nullptr;
stringlist_t* keylist_used = nullptr;
PEP_rating rating;
PEP_decrypt_flags_t flags;
flags = 0;
status = decrypt_message(session, encrypted_msg, &decrypted_msg, &keylist_used, &rating, &flags);
status = decrypt_message(session, encrypted_msg, &decrypted_msg, &keylist_used, &flags);
ASSERT_NOTNULL(decrypted_msg);
PEP_rating rating = decrypted_msg->rating;
ASSERT_NOTNULL(keylist_used);
ASSERT_NE(rating, 0);
ASSERT_TRUE(status == PEP_DECRYPTED && rating == PEP_rating_unreliable);
@ -485,8 +486,9 @@ TEST_F(EncryptForIdentityTest, check_encrypt_for_identity_with_URI) {
output_stream << "message encrypted.\n";
flags = 0;
status = decrypt_message(session, encrypted_msg, &decrypted_msg, &keylist_used, &rating, &flags);
status = decrypt_message(session, encrypted_msg, &decrypted_msg, &keylist_used, &flags);
ASSERT_NOTNULL(decrypted_msg);
rating = decrypted_msg->rating;
ASSERT_NOTNULL(keylist_used);
ASSERT_NE(rating, 0);
ASSERT_TRUE(status == PEP_DECRYPTED && rating == PEP_rating_unreliable);


+ 7
- 7
test/src/Engine463Test.cc View File

@ -99,10 +99,9 @@ TEST_F(Engine463Test, check_engine_463_no_own_key) {
message* decrypted_msg = NULL;
stringlist_t* keylist_used = nullptr;
PEP_rating rating;
PEP_decrypt_flags_t flags = 0;
status = decrypt_message(session, msg, &decrypted_msg, &keylist_used, &rating, &flags);
status = decrypt_message(session, msg, &decrypted_msg, &keylist_used, &flags);
ASSERT_OK;
}
@ -126,10 +125,9 @@ TEST_F(Engine463Test, check_engine_463_sender_expired_and_renewed) {
message* decrypted_msg = NULL;
stringlist_t* keylist_used = nullptr;
PEP_rating rating;
PEP_decrypt_flags_t flags = 0;
status = decrypt_message(session, msg, &decrypted_msg, &keylist_used, &rating, &flags);
status = decrypt_message(session, msg, &decrypted_msg, &keylist_used, &flags);
ASSERT_EQ(status , PEP_DECRYPTED);
free(decrypted_msg);
@ -139,15 +137,17 @@ TEST_F(Engine463Test, check_engine_463_sender_expired_and_renewed) {
pEp_identity* expired_inquisitor = new_identity("inquisitor@darthmama.org", NULL, NULL, "Lady Claire Trevelyan");
PEP_rating rating;
status = identity_rating(session, expired_inquisitor, &rating);
ASSERT_OK;
ASSERT_EQ(rating , PEP_rating_reliable);
flags = 0;
status = decrypt_message(session, msg, &decrypted_msg, &keylist_used, &rating, &flags);
status = decrypt_message(session, msg, &decrypted_msg, &keylist_used, &flags);
ASSERT_NOTNULL(decrypted_msg);
ASSERT_OK;
rating = decrypted_msg->rating;
ASSERT_EQ(rating , PEP_rating_reliable);
free_identity(expired_inquisitor);
@ -180,10 +180,9 @@ TEST_F(Engine463Test, check_engine_463_sender_expired_and_renewed) {
message* decrypted_msg = NULL;
stringlist_t* keylist_used = nullptr;
PEP_rating rating;
PEP_decrypt_flags_t flags = 0;
status = decrypt_message(session, msg, &decrypted_msg, &keylist_used, &rating, &flags);
status = decrypt_message(session, msg, &decrypted_msg, &keylist_used, &flags);
ASSERT_EQ(status , PEP_DECRYPTED);
free(decrypted_msg);
@ -200,6 +199,7 @@ TEST_F(Engine463Test, check_engine_463_sender_expired_and_renewed) {
msg2->longmsg = strdup("Blahblahblah!");
msg2->attachments = new_bloblist(NULL, 0, "application/octet-stream", NULL);
PEP_rating rating;
status = outgoing_message_rating(session, msg2, &rating);
ASSERT_OK;
ASSERT_EQ(rating , PEP_rating_reliable);


+ 1
- 2
test/src/Engine514Test.cc View File

@ -268,9 +268,8 @@ TEST_F(Engine514Test, check_engine514_encrypted) {
message* dec_msg = NULL;
PEP_decrypt_flags_t flags = 0;
stringlist_t* keylist = NULL;
PEP_rating rating;
status = decrypt_message(session, enc_msg, &dec_msg, &keylist, &rating, &flags);
status = decrypt_message(session, enc_msg, &dec_msg, &keylist, &flags);
ASSERT_EQ(status, PEP_STATUS_OK);
ASSERT_STREQ(msg->attachments->mime_type, "message/rfc822");
ASSERT_NULL(msg->attachments->next);


+ 1
- 2
test/src/Engine619Test.cc View File

@ -439,11 +439,10 @@ TEST_F(Engine619Test, decrypt_message_with_private_key) {
message *message_dst;
stringlist_t* keys = NULL;
PEP_rating rating;
PEP_decrypt_flags_t flags = 0;
status = decrypt_message(session, message_src, & message_dst,
& keys, & rating, & flags);
& keys, & flags);
/* It is normal and expected that decryption fails here: this message is
unencrypted. The point of this test is to arrive at a call to
pgp_import_keydata , which used to corrut the heap (ENGINE-619). */


+ 1
- 2
test/src/Engine655Test.cc View File

@ -143,9 +143,8 @@ TEST_F(Engine655Test, check_engine655) {
//
keylist = NULL;
message* dec_msg = NULL;
PEP_rating rating;
PEP_decrypt_flags_t flags = 0;
status = decrypt_message(session, msg, &dec_msg, &keylist, &rating, &flags);
status = decrypt_message(session, msg, &dec_msg, &keylist, &flags);
EXPECT_EQ(status, PEP_DECRYPTED); // really, expect PEP_STATUS_OK, but it doesn't verify and msg may be broken
// EXPECT_NE(ptext, nullptr);
// EXPECT_NE(keylist, nullptr);


+ 1
- 2
test/src/Engine704Test.cc View File

@ -128,10 +128,9 @@ TEST_F(Engine704Test, check_engine704) {
message* dec_msg = NULL;
enc_msg->dir = PEP_dir_incoming;
stringlist_t* keylist = NULL;
PEP_rating rating;
PEP_decrypt_flags_t flags = 0;
status = decrypt_message(session, enc_msg, &dec_msg, &keylist, &rating, &flags);
status = decrypt_message(session, enc_msg, &dec_msg, &keylist, &flags);
ASSERT_STREQ(dec_msg->from->username, alicename);
ASSERT_STREQ(dec_msg->to->ident->username, bobname);
}

+ 4
- 3
test/src/ExternalRevokeTest.cc View File

@ -196,7 +196,6 @@ TEST_F(ExternalRevokeTest, check_external_revoke) {
outgoing_msg = NULL;
stringlist_t* keylist = nullptr;
PEP_rating rating;
PEP_decrypt_flags_t flags;
output_stream << endl << "---------------------------------------------------------" << endl;
@ -205,9 +204,10 @@ TEST_F(ExternalRevokeTest, check_external_revoke) {
flags = 0;
output_stream << "Decrypting message." << endl;
status = decrypt_message(session, encrypted_outgoing_msg, &outgoing_msg, &keylist, &rating, &flags);
status = decrypt_message(session, encrypted_outgoing_msg, &outgoing_msg, &keylist, &flags);
output_stream << "Decrypted message with status " << tl_status_string(status) << endl;
ASSERT_OK;
PEP_rating rating = outgoing_msg->rating;
ASSERT_EQ(rating , PEP_rating_trusted);
// check rating
@ -384,10 +384,11 @@ TEST_F(ExternalRevokeTest, check_external_revoke) {
flags = 0;
status = decrypt_message(session, encrypted_outgoing_msg, &decrypted_msg, &keylist, &rating, &flags);
status = decrypt_message(session, encrypted_outgoing_msg, &decrypted_msg, &keylist, &flags);
output_stream << "Decryption returns with status " << tl_status_string(status) << endl;
ASSERT_EQ(status, PEP_STATUS_OK);
ASSERT_NOTNULL(decrypted_msg);
rating = decrypted_msg->rating;
// check rating
output_stream << "Rating of decrypted message to trusted recip: " << tl_rating_string(rating) << endl;


+ 34
- 59
test/src/GroupEncryptionTest.cc View File

@ -1030,10 +1030,9 @@ TEST_F(GroupEncryptionTest, check_protocol_group_create_receive_member_1) {
message* dec_msg = NULL;
stringlist_t* keylist = NULL;
PEP_rating rating;
PEP_decrypt_flags_t flags = 0;
status = decrypt_message(session, msg, &dec_msg, &keylist, &rating, &flags);
status = decrypt_message(session, msg, &dec_msg, &keylist, &flags);
ASSERT_OK;
// Ok, so that worked.
@ -1122,10 +1121,9 @@ TEST_F(GroupEncryptionTest, check_protocol_group_create_receive_member_2) {
message* dec_msg = NULL;
stringlist_t* keylist = NULL;
PEP_rating rating;
PEP_decrypt_flags_t flags = 0;
status = decrypt_message(session, msg, &dec_msg, &keylist, &rating, &flags);
status = decrypt_message(session, msg, &dec_msg, &keylist, &flags);
ASSERT_OK;
// Ok, so that worked.
@ -1187,10 +1185,9 @@ TEST_F(GroupEncryptionTest, check_protocol_group_create_receive_member_3) {
message* dec_msg = NULL;
stringlist_t* keylist = NULL;
PEP_rating rating;
PEP_decrypt_flags_t flags = 0;
status = decrypt_message(session, msg, &dec_msg, &keylist, &rating, &flags);
status = decrypt_message(session, msg, &dec_msg, &keylist, &flags);
ASSERT_OK;
// Ok, so that worked.
@ -1252,10 +1249,9 @@ TEST_F(GroupEncryptionTest, check_protocol_group_create_receive_member_4) {
message* dec_msg = NULL;
stringlist_t* keylist = NULL;
PEP_rating rating;
PEP_decrypt_flags_t flags = 0;
status = decrypt_message(session, msg, &dec_msg, &keylist, &rating, &flags);
status = decrypt_message(session, msg, &dec_msg, &keylist, &flags);
ASSERT_OK;
// Ok, so that worked.
@ -1486,10 +1482,9 @@ TEST_F(GroupEncryptionTest, check_protocol_group_join_member_1) {
message* dec_msg = NULL;
stringlist_t* keylist = NULL;
PEP_rating rating;
PEP_decrypt_flags_t flags = 0;
status = decrypt_message(session, msg, &dec_msg, &keylist, &rating, &flags);
status = decrypt_message(session, msg, &dec_msg, &keylist, &flags);
ASSERT_OK;
pEp_identity* group_identity = new_identity(group_1_address, NULL, own_id, NULL);
@ -1560,10 +1555,9 @@ TEST_F(GroupEncryptionTest, check_protocol_group_join_member_2) {
message* dec_msg = NULL;
stringlist_t* keylist = NULL;
PEP_rating rating;
PEP_decrypt_flags_t flags = 0;
status = decrypt_message(session, msg, &dec_msg, &keylist, &rating, &flags);
status = decrypt_message(session, msg, &dec_msg, &keylist, &flags);
ASSERT_OK;
pEp_identity* group_identity = new_identity(group_1_address, NULL, own_id, NULL);
@ -1620,10 +1614,9 @@ TEST_F(GroupEncryptionTest, check_protocol_group_join_member_3) {
message* dec_msg = NULL;
stringlist_t* keylist = NULL;
PEP_rating rating;
PEP_decrypt_flags_t flags = 0;
status = decrypt_message(session, msg, &dec_msg, &keylist, &rating, &flags);
status = decrypt_message(session, msg, &dec_msg, &keylist, &flags);
ASSERT_OK;
pEp_identity* group_identity = new_identity(group_1_address, NULL, own_id, NULL);
@ -1680,10 +1673,9 @@ TEST_F(GroupEncryptionTest, check_protocol_group_join_member_4) {
message* dec_msg = NULL;
stringlist_t* keylist = NULL;
PEP_rating rating;
PEP_decrypt_flags_t flags = 0;
status = decrypt_message(session, msg, &dec_msg, &keylist, &rating, &flags);
status = decrypt_message(session, msg, &dec_msg, &keylist, &flags);
ASSERT_OK;
pEp_identity* group_identity = new_identity(group_1_address, NULL, own_id, NULL);
@ -1777,10 +1769,9 @@ TEST_F(GroupEncryptionTest, check_protocol_group_join_receive) {
message* dec_msg = NULL;
stringlist_t* keylist = NULL;
PEP_rating rating;
PEP_decrypt_flags_t flags = 0;
status = decrypt_message(session, msg, &dec_msg, &keylist, &rating, &flags);
status = decrypt_message(session, msg, &dec_msg, &keylist, &flags);
ASSERT_OK;
// Ok, so that worked.
@ -1877,9 +1868,8 @@ TEST_F(GroupEncryptionTest, check_protocol_group_dissolve_send) {
mime_decode_message(msg_str.c_str(), msg_str.size(), &msg, NULL);
message* dec_msg = NULL;
stringlist_t* keylist = NULL;
PEP_rating rating;
PEP_decrypt_flags_t flags = 0;
status = decrypt_message(session, msg, &dec_msg, &keylist, &rating, &flags);
status = decrypt_message(session, msg, &dec_msg, &keylist, &flags);
ASSERT_OK;
// Member 1
@ -1891,9 +1881,8 @@ TEST_F(GroupEncryptionTest, check_protocol_group_dissolve_send) {
dec_msg = NULL;
free_stringlist(keylist);
keylist = NULL;
rating = PEP_rating_undefined;
flags = 0;
status = decrypt_message(session, msg, &dec_msg, &keylist, &rating, &flags);
status = decrypt_message(session, msg, &dec_msg, &keylist, &flags);
ASSERT_OK;
// Member 2
@ -1905,9 +1894,8 @@ TEST_F(GroupEncryptionTest, check_protocol_group_dissolve_send) {
dec_msg = NULL;
free_stringlist(keylist);
keylist = NULL;
rating = PEP_rating_undefined;
flags = 0;
status = decrypt_message(session, msg, &dec_msg, &keylist, &rating, &flags);
status = decrypt_message(session, msg, &dec_msg, &keylist, &flags);
ASSERT_OK;
free_message(msg);
@ -2070,9 +2058,8 @@ TEST_F(GroupEncryptionTest, check_protocol_group_dissolve_receive) {
message* dec_msg = NULL;
stringlist_t* keylist = NULL;
PEP_rating rating;
PEP_decrypt_flags_t flags = 0;
status = decrypt_message(session, msg, &dec_msg, &keylist, &rating, &flags);
status = decrypt_message(session, msg, &dec_msg, &keylist, &flags);
ASSERT_OK;
@ -2110,7 +2097,7 @@ TEST_F(GroupEncryptionTest, check_protocol_group_dissolve_receive) {
dec_msg = NULL;
keylist = NULL;
flags = 0;
status = decrypt_message(session, msg, &dec_msg, &keylist, &rating, &flags);
status = decrypt_message(session, msg, &dec_msg, &keylist, &flags);
ASSERT_OK;
status = retrieve_own_membership_info_for_group_and_identity(session, group, me);
@ -2181,10 +2168,9 @@ TEST_F(GroupEncryptionTest, check_protocol_group_join_member_unknown) {
message* dec_msg = NULL;
stringlist_t* keylist = NULL;
PEP_rating rating;
PEP_decrypt_flags_t flags = 0;
status = decrypt_message(session, msg, &dec_msg, &keylist, &rating, &flags);
status = decrypt_message(session, msg, &dec_msg, &keylist, &flags);
ASSERT_OK;
// Now make sure we didn't do anything with the message
@ -2233,8 +2219,7 @@ TEST_F(GroupEncryptionTest, check_protocol_group_dissolve_group_unknown) {
message* dec_msg = NULL;
stringlist_t* keylist = NULL;
PEP_decrypt_flags_t flags = 0;
PEP_rating rating;
status = decrypt_message(session, msg, &dec_msg, &keylist, &rating, &flags);
status = decrypt_message(session, msg, &dec_msg, &keylist, &flags);
ASSERT_OK;
pEp_identity* group_identity = new_identity(group_1_address, NULL, own_id, NULL);
@ -2616,10 +2601,9 @@ TEST_F(GroupEncryptionTest, check_protocol_group_dissolve_not_manager) {
message* dec_msg = NULL;
stringlist_t* keylist = NULL;
PEP_rating rating;
PEP_decrypt_flags_t flags = 0;
status = decrypt_message(session, msg, &dec_msg, &keylist, &rating, &flags);
status = decrypt_message(session, msg, &dec_msg, &keylist, &flags);
ASSERT_OK;
free_message(msg);
@ -2635,7 +2619,7 @@ TEST_F(GroupEncryptionTest, check_protocol_group_dissolve_not_manager) {
keylist = NULL;
flags = 0;
status = decrypt_message(session, msg, &dec_msg, &keylist, &rating, &flags);
status = decrypt_message(session, msg, &dec_msg, &keylist, &flags);
free_message(msg);
ASSERT_OK;
free_message(dec_msg);
@ -2661,7 +2645,7 @@ TEST_F(GroupEncryptionTest, check_protocol_group_dissolve_not_manager) {
keylist = NULL;
flags = 0;
status = decrypt_message(session, msg, &dec_msg, &keylist, &rating, &flags);
status = decrypt_message(session, msg, &dec_msg, &keylist, &flags);
free_message(msg);
free_message(dec_msg);
ASSERT_OK;
@ -3099,15 +3083,14 @@ TEST_F(GroupEncryptionTest, check_protocol_group_key_reset_two_recents) {
ASSERT_NE(message_2, nullptr);
stringlist_t* keylist = NULL;
PEP_rating rating;
PEP_decrypt_flags_t flags = 0;
message* dec_msg = NULL;
status = decrypt_message(session, message_1, &dec_msg, &keylist, &rating, &flags);
status = decrypt_message(session, message_1, &dec_msg, &keylist, &flags);
ASSERT_OK;
free_message(dec_msg);
dec_msg = NULL;
status = decrypt_message(session, message_2, &dec_msg, &keylist, &rating, &flags);
status = decrypt_message(session, message_2, &dec_msg, &keylist, &flags);
ASSERT_OK;
free_message(dec_msg);
dec_msg = NULL;
@ -3199,13 +3182,12 @@ TEST_F(GroupEncryptionTest, check_group_key_reset_receive_member_2) {
message* enc_msg = NULL;
message* dec_msg = NULL;
stringlist_t* keylist = NULL;
PEP_rating rating;
PEP_decrypt_flags_t flags = 0;
enc_msg = string_to_msg(invite);
ASSERT_NE(enc_msg, nullptr);
status = decrypt_message(session, enc_msg, &dec_msg, &keylist, &rating, &flags);
status = decrypt_message(session, enc_msg, &dec_msg, &keylist, &flags);
ASSERT_OK;
pEp_identity* group_ident = new_identity(group_1_address, NULL, "MEMBER2", group_1_name);
@ -3224,7 +3206,7 @@ TEST_F(GroupEncryptionTest, check_group_key_reset_receive_member_2) {
enc_msg = string_to_msg(resetmsg);
ASSERT_NE(enc_msg, nullptr);
free_message(dec_msg);
status = decrypt_message(session, enc_msg, &dec_msg, &keylist, &rating, &flags);
status = decrypt_message(session, enc_msg, &dec_msg, &keylist, &flags);
ASSERT_OK;
bool is_revoked;
@ -3261,11 +3243,10 @@ TEST_F(GroupEncryptionTest, check_group_key_reset_receive_partner_1) {
message* enc_msg = string_to_msg(slurp(string("test_mails/group_key_reset_mixed_output_to_partner_public_") + manager_2_address + ".eml"));
ASSERT_NE(enc_msg, nullptr);
stringlist_t* keylist = NULL;
PEP_rating rating;
PEP_decrypt_flags_t flags = 0;
message* dec_msg = NULL;
status = decrypt_message(session, enc_msg, &dec_msg, &keylist, &rating, &flags);
status = decrypt_message(session, enc_msg, &dec_msg, &keylist, &flags);
ASSERT_OK;
// FIXME: reinstate this when key election removal is in - fails due to delete_keypair
@ -3304,11 +3285,10 @@ TEST_F(GroupEncryptionTest, check_group_key_reset_receive_partner_2) {
message* enc_msg = string_to_msg(slurp(string("test_mails/group_key_reset_mixed_output_to_partner_public_") + me->address + ".eml"));
ASSERT_NE(enc_msg, nullptr);
stringlist_t* keylist = NULL;
PEP_rating rating;
PEP_decrypt_flags_t flags = 0;
message* dec_msg = NULL;
status = decrypt_message(session, enc_msg, &dec_msg, &keylist, &rating, &flags);
status = decrypt_message(session, enc_msg, &dec_msg, &keylist, &flags);
ASSERT_OK;
// FIXME: reinstate this when key election removal is in - fails due to delete_keypair
@ -3447,15 +3427,14 @@ TEST_F(GroupEncryptionTest, check_protocol_group_key_reset_two_recents_two_missi
ASSERT_NE(message_2, nullptr);
stringlist_t* keylist = NULL;
PEP_rating rating;
PEP_decrypt_flags_t flags = 0;
message* dec_msg = NULL;
status = decrypt_message(session, message_1, &dec_msg, &keylist, &rating, &flags);
status = decrypt_message(session, message_1, &dec_msg, &keylist, &flags);
ASSERT_OK;
free_message(dec_msg);
dec_msg = NULL;
status = decrypt_message(session, message_2, &dec_msg, &keylist, &rating, &flags);
status = decrypt_message(session, message_2, &dec_msg, &keylist, &flags);
ASSERT_OK;
free_message(dec_msg);
dec_msg = NULL;
@ -3617,11 +3596,10 @@ TEST_F(GroupEncryptionTest, check_protocol_group_key_reset_one_recent_all_missin
ASSERT_NE(message_1, nullptr);
stringlist_t* keylist = NULL;
PEP_rating rating;
PEP_decrypt_flags_t flags = 0;
message* dec_msg = NULL;
status = decrypt_message(session, message_1, &dec_msg, &keylist, &rating, &flags);
status = decrypt_message(session, message_1, &dec_msg, &keylist, &flags);
ASSERT_OK;
free_message(dec_msg);
free_message(message_1);
@ -3870,15 +3848,14 @@ TEST_F(GroupEncryptionTest, check_protocol_remove_member_from_group_two_recents)
ASSERT_NE(message_2, nullptr);
stringlist_t* keylist = NULL;
PEP_rating rating;
PEP_decrypt_flags_t flags = 0;
message* dec_msg = NULL;
status = decrypt_message(session, message_1, &dec_msg, &keylist, &rating, &flags);
status = decrypt_message(session, message_1, &dec_msg, &keylist, &flags);
ASSERT_OK;
free_message(dec_msg);
dec_msg = NULL;
status = decrypt_message(session, message_2, &dec_msg, &keylist, &rating, &flags);
status = decrypt_message(session, message_2, &dec_msg, &keylist, &flags);
ASSERT_OK;
free_message(dec_msg);
dec_msg = NULL;
@ -4079,15 +4056,14 @@ TEST_F(GroupEncryptionTest, check_protocol_remove_member_not_joined_from_group_t
ASSERT_NE(message_2, nullptr);
stringlist_t* keylist = NULL;
PEP_rating rating;
PEP_decrypt_flags_t flags = 0;
message* dec_msg = NULL;
status = decrypt_message(session, message_1, &dec_msg, &keylist, &rating, &flags);
status = decrypt_message(session, message_1, &dec_msg, &keylist, &flags);
ASSERT_OK;
free_message(dec_msg);
dec_msg = NULL;
status = decrypt_message(session, message_2, &dec_msg, &keylist, &rating, &flags);
status = decrypt_message(session, message_2, &dec_msg, &keylist, &flags);
ASSERT_OK;
free_message(dec_msg);
dec_msg = NULL;
@ -4287,15 +4263,14 @@ TEST_F(GroupEncryptionTest, check_protocol_remove_unknown_member_from_group_two_
ASSERT_NE(message_2, nullptr);
stringlist_t* keylist = NULL;
PEP_rating rating;
PEP_decrypt_flags_t flags = 0;
message* dec_msg = NULL;
status = decrypt_message(session, message_1, &dec_msg, &keylist, &rating, &flags);
status = decrypt_message(session, message_1, &dec_msg, &keylist, &flags);
ASSERT_OK;
free_message(dec_msg);
dec_msg = NULL;
status = decrypt_message(session, message_2, &dec_msg, &keylist, &rating, &flags);
status = decrypt_message(session, message_2, &dec_msg, &keylist, &flags);
ASSERT_OK;
free_message(dec_msg);
dec_msg = NULL;


+ 3
- 3
test/src/HeaderKeyImportTest.cc View File

@ -726,14 +726,14 @@ TEST_F(HeaderKeyImportTest, check_header_key_import) {
stringlist_t* keylist = NULL;
PEP_rating rating;
PEP_decrypt_flags_t flags;
flags = 0;
message* enc_msg = string_to_msg(strmsg);
PEP_STATUS status = decrypt_message(session, enc_msg, &dec_msg, &keylist, &rating, &flags);
ASSERT_EQ(rating , PEP_rating_reliable);
PEP_STATUS status = decrypt_message(session, enc_msg, &dec_msg, &keylist, &flags);
ASSERT_OK;
PEP_rating rating = dec_msg->rating;
ASSERT_EQ(rating, PEP_rating_reliable);
pEp_identity* alice_check = new_identity("pep.test.alice@pep-project.org", NULL, NULL, "pEp Test Alice");
status = update_identity(session, alice_check);


+ 18
- 36
test/src/KeyAttachmentTest.cc View File

@ -105,9 +105,8 @@ TEST_F(KeyAttachmentTest, check_key_attach_inline) {
ASSERT_OK;
ASSERT_NOTNULL(enc_msg);
stringlist_t* keylist = NULL;
PEP_rating rating;
PEP_decrypt_flags_t flags = 0;
status = decrypt_message(session, enc_msg, &dec_msg, &keylist, &rating, &flags);
status = decrypt_message(session, enc_msg, &dec_msg, &keylist, &flags);
ASSERT_EQ(status , PEP_DECRYPTED);
#if KEYS_STAY_ATTACHED
ASSERT_NOTNULL(dec_msg->attachments );
@ -132,9 +131,8 @@ TEST_F(KeyAttachmentTest, check_key_plus_encr_att_inline) {
ASSERT_OK;
ASSERT_NOTNULL(enc_msg);
stringlist_t* keylist = NULL;
PEP_rating rating;
PEP_decrypt_flags_t flags = 0;
status = decrypt_message(session, enc_msg, &dec_msg, &keylist, &rating, &flags);
status = decrypt_message(session, enc_msg, &dec_msg, &keylist, &flags);
ASSERT_EQ(status , PEP_DECRYPTED);
ASSERT_NOTNULL(dec_msg);
#if KEYS_STAY_ATTACHED
@ -167,9 +165,8 @@ TEST_F(KeyAttachmentTest, check_encr_att_plus_key_inline) {
ASSERT_OK;
ASSERT_NOTNULL(enc_msg);
stringlist_t* keylist = NULL;
PEP_rating rating;
PEP_decrypt_flags_t flags = 0;
status = decrypt_message(session, enc_msg, &dec_msg, &keylist, &rating, &flags);
status = decrypt_message(session, enc_msg, &dec_msg, &keylist, &flags);
ASSERT_OK;
ASSERT_NOTNULL(dec_msg);
#if KEYS_STAY_ATTACHED
@ -204,9 +201,8 @@ TEST_F(KeyAttachmentTest, check_key_plus_unencr_att_inline) {
ASSERT_OK;
ASSERT_NOTNULL(enc_msg);
stringlist_t* keylist = NULL;
PEP_rating rating;
PEP_decrypt_flags_t flags = 0;
status = decrypt_message(session, enc_msg, &dec_msg, &keylist, &rating, &flags);
status = decrypt_message(session, enc_msg, &dec_msg, &keylist, &flags);
ASSERT_EQ(status , PEP_DECRYPTED);
ASSERT_NOTNULL(dec_msg);
#if KEYS_STAY_ATTACHED
@ -241,9 +237,8 @@ TEST_F(KeyAttachmentTest, check_unencr_att_plus_key_inline) {
ASSERT_OK;
ASSERT_NOTNULL(enc_msg);
stringlist_t* keylist = NULL;
PEP_rating rating;
PEP_decrypt_flags_t flags = 0;
status = decrypt_message(session, enc_msg, &dec_msg, &keylist, &rating, &flags);
status = decrypt_message(session, enc_msg, &dec_msg, &keylist, &flags);
ASSERT_OK;
ASSERT_NOTNULL(dec_msg);
ASSERT_NOTNULL(dec_msg->attachments);
@ -276,9 +271,8 @@ TEST_F(KeyAttachmentTest, check_many_keys_inline) {
ASSERT_OK;
ASSERT_NOTNULL(enc_msg);
stringlist_t* keylist = NULL;
PEP_rating rating;
PEP_decrypt_flags_t flags = 0;
status = decrypt_message(session, enc_msg, &dec_msg, &keylist, &rating, &flags);
status = decrypt_message(session, enc_msg, &dec_msg, &keylist, &flags);
ASSERT_EQ(status , PEP_DECRYPTED);
ASSERT_NOTNULL(dec_msg);
#if KEYS_STAY_ATTACHED
@ -300,9 +294,8 @@ TEST_F(KeyAttachmentTest, check_many_keys_w_encr_file_inline) {
ASSERT_OK;
ASSERT_NOTNULL(enc_msg);
stringlist_t* keylist = NULL;
PEP_rating rating;
PEP_decrypt_flags_t flags = 0;
status = decrypt_message(session, enc_msg, &dec_msg, &keylist, &rating, &flags);
status = decrypt_message(session, enc_msg, &dec_msg, &keylist, &flags);
ASSERT_OK;
ASSERT_NOTNULL(dec_msg);
#if KEYS_STAY_ATTACHED
@ -334,9 +327,8 @@ TEST_F(KeyAttachmentTest, check_many_keys_w_unencr_file_inline) {
ASSERT_OK;
ASSERT_NOTNULL(enc_msg);
stringlist_t* keylist = NULL;
PEP_rating rating;
PEP_decrypt_flags_t flags = 0;
status = decrypt_message(session, enc_msg, &dec_msg, &keylist, &rating, &flags);
status = decrypt_message(session, enc_msg, &dec_msg, &keylist, &flags);
ASSERT_OK;
ASSERT_NOTNULL(dec_msg);
#if KEYS_STAY_ATTACHED
@ -368,9 +360,8 @@ TEST_F(KeyAttachmentTest, check_many_keys_with_many_files_inline) {
ASSERT_OK;
ASSERT_NOTNULL(enc_msg);
stringlist_t* keylist = NULL;
PEP_rating rating;
PEP_decrypt_flags_t flags = 0;
status = decrypt_message(session, enc_msg, &dec_msg, &keylist, &rating, &flags);
status = decrypt_message(session, enc_msg, &dec_msg, &keylist, &flags);
ASSERT_OK;
ASSERT_NOTNULL(dec_msg);
@ -424,9 +415,8 @@ TEST_F(KeyAttachmentTest, check_key_attach_OpenPGP) {
ASSERT_OK;
ASSERT_NOTNULL(enc_msg);
stringlist_t* keylist = NULL;
PEP_rating rating;
PEP_decrypt_flags_t flags = 0;
status = decrypt_message(session, enc_msg, &dec_msg, &keylist, &rating, &flags);
status = decrypt_message(session, enc_msg, &dec_msg, &keylist, &flags);
ASSERT_OK;
ASSERT_NOTNULL(dec_msg);
#if KEYS_STAY_ATTACHED
@ -452,9 +442,8 @@ TEST_F(KeyAttachmentTest, check_key_plus_encr_att_OpenPGP) {
ASSERT_OK;
ASSERT_NOTNULL(enc_msg);
stringlist_t* keylist = NULL;
PEP_rating rating;
PEP_decrypt_flags_t flags = 0;
status = decrypt_message(session, enc_msg, &dec_msg, &keylist, &rating, &flags);
status = decrypt_message(session, enc_msg, &dec_msg, &keylist, &flags);
ASSERT_EQ(status , PEP_DECRYPTED);
ASSERT_NOTNULL(dec_msg);
#if KEYS_STAY_ATTACHED
@ -486,9 +475,8 @@ TEST_F(KeyAttachmentTest, check_encr_att_plus_key_OpenPGP) {
ASSERT_OK;
ASSERT_NOTNULL(enc_msg);
stringlist_t* keylist = NULL;
PEP_rating rating;
PEP_decrypt_flags_t flags = 0;
status = decrypt_message(session, enc_msg, &dec_msg, &keylist, &rating, &flags);
status = decrypt_message(session, enc_msg, &dec_msg, &keylist, &flags);
ASSERT_EQ(status , PEP_DECRYPTED);
ASSERT_NOTNULL(dec_msg);
#if KEYS_STAY_ATTACHED
@ -523,9 +511,8 @@ TEST_F(KeyAttachmentTest, check_key_plus_unencr_att_OpenPGP) {
ASSERT_OK;
ASSERT_NOTNULL(enc_msg);
stringlist_t* keylist = NULL;
PEP_rating rating;
PEP_decrypt_flags_t flags = 0;
status = decrypt_message(session, enc_msg, &dec_msg, &keylist, &rating, &flags);
status = decrypt_message(session, enc_msg, &dec_msg, &keylist, &flags);
ASSERT_OK;
ASSERT_NOTNULL(dec_msg);
#if KEYS_STAY_ATTACHED
@ -559,9 +546,8 @@ TEST_F(KeyAttachmentTest, check_unencr_att_plus_key_OpenPGP) {
ASSERT_OK;
ASSERT_NOTNULL(enc_msg);
stringlist_t* keylist = NULL;
PEP_rating rating;
PEP_decrypt_flags_t flags = 0;
status = decrypt_message(session, enc_msg, &dec_msg, &keylist, &rating, &flags);
status = decrypt_message(session, enc_msg, &dec_msg, &keylist, &flags);
ASSERT_EQ(status , PEP_DECRYPTED);
ASSERT_NOTNULL(dec_msg);
ASSERT_NOTNULL(dec_msg->attachments);
@ -589,9 +575,8 @@ TEST_F(KeyAttachmentTest, check_many_keys_OpenPGP) {
ASSERT_OK;
ASSERT_NOTNULL(enc_msg);
stringlist_t* keylist = NULL;
PEP_rating rating;
PEP_decrypt_flags_t flags = 0;
status = decrypt_message(session, enc_msg, &dec_msg, &keylist, &rating, &flags);
status = decrypt_message(session, enc_msg, &dec_msg, &keylist, &flags);
ASSERT_EQ(status , PEP_DECRYPTED);
ASSERT_NOTNULL(dec_msg);
#if KEYS_STAY_ATTACHED
@ -613,9 +598,8 @@ TEST_F(KeyAttachmentTest, check_many_keys_w_encr_file_OpenPGP) {
ASSERT_OK;
ASSERT_NOTNULL(enc_msg);
stringlist_t* keylist = NULL;
PEP_rating rating;
PEP_decrypt_flags_t flags = 0;
status = decrypt_message(session, enc_msg, &dec_msg, &keylist, &rating, &flags);
status = decrypt_message(session, enc_msg, &dec_msg, &keylist, &flags);
ASSERT_EQ(status , PEP_DECRYPTED);
ASSERT_NOTNULL(dec_msg);
ASSERT_NOTNULL(dec_msg->attachments);
@ -645,9 +629,8 @@ TEST_F(KeyAttachmentTest, check_many_keys_w_unencr_file_OpenPGP) {
ASSERT_OK;
ASSERT_NOTNULL(enc_msg);
stringlist_t* keylist = NULL;
PEP_rating rating;
PEP_decrypt_flags_t flags = 0;
status = decrypt_message(session, enc_msg, &dec_msg, &keylist, &rating, &flags);
status = decrypt_message(session, enc_msg, &dec_msg, &keylist, &flags);
ASSERT_EQ(status , PEP_DECRYPTED);
ASSERT_NOTNULL(dec_msg);
ASSERT_NOTNULL(dec_msg->attachments);
@ -677,9 +660,8 @@ TEST_F(KeyAttachmentTest, check_many_keys_w_many_files_OpenPGP) {
ASSERT_OK;
ASSERT_NOTNULL(enc_msg);
stringlist_t* keylist = NULL;
PEP_rating rating;
PEP_decrypt_flags_t flags = 0;
status = decrypt_message(session, enc_msg, &dec_msg, &keylist, &rating, &flags);
status = decrypt_message(session, enc_msg, &dec_msg, &keylist, &flags);
ASSERT_OK;
ASSERT_NOTNULL(dec_msg);


+ 16
- 26
test/src/KeyResetMessageTest.cc View File

@ -416,14 +416,13 @@ TEST_F(KeyResetMessageTest, check_non_reset_receive_revoked) {
char* decrypted_msg = NULL;
char* modified_src = NULL;
stringlist_t* keylist = NULL;
PEP_rating rating;
PEP_decrypt_flags_t flags = 0;
message* enc_msg_obj = NULL;
message* dec_msg_obj = NULL;
status = mime_decode_message(received_mail.c_str(), received_mail.size(), &enc_msg_obj, NULL);
ASSERT_OK;
status = decrypt_message(session, enc_msg_obj, &dec_msg_obj, &keylist, &rating, &flags);
status = decrypt_message(session, enc_msg_obj, &dec_msg_obj, &keylist, &flags);
ASSERT_OK;
@ -473,10 +472,9 @@ TEST_F(KeyResetMessageTest, check_reset_receive_revoked) {
message* received_mail = slurp_message_file_into_struct("test_files/398_reset_from_alice_to_fenris.eml");
message* decrypted_msg = NULL;
stringlist_t* keylist = NULL;
PEP_rating rating;
PEP_decrypt_flags_t flags = 0;
status = decrypt_message(session, received_mail,
&decrypted_msg, &keylist, &rating, &flags);
&decrypted_msg, &keylist, &flags);
ASSERT_OK;
ASSERT_NOTNULL(keylist);
@ -514,9 +512,8 @@ TEST_F(KeyResetMessageTest, revoke_and_check_receive_message) {
message* dec_msg = NULL;
stringlist_t* keylist = NULL;
PEP_decrypt_flags_t flags = 0;
PEP_rating rating;
status = decrypt_message(session, enc_msg, &dec_msg, &keylist, &rating, &flags);
status = decrypt_message(session, enc_msg, &dec_msg, &keylist, &flags);
ASSERT_EQ(status, PEP_STATUS_OK);
ASSERT_NOTNULL(dec_msg);
ASSERT_EQ(m_queue.size() , 0);
@ -544,10 +541,9 @@ TEST_F(KeyResetMessageTest, check_receive_message_to_revoked_key_from_unknown) {
message* received_mail = slurp_message_file_into_struct("test_files/398_gabrielle_to_alice.eml");
message* decrypted_msg = NULL;
stringlist_t* keylist = NULL;
PEP_rating rating;
PEP_decrypt_flags_t flags = 0;
status = decrypt_message(session, received_mail,
&decrypted_msg, &keylist, &rating, &flags);
&decrypted_msg, &keylist, &flags);
ASSERT_EQ(m_queue.size() , 0);
free_message(decrypted_msg);
free_message(received_mail);
@ -611,7 +607,6 @@ TEST_F(KeyResetMessageTest, check_receive_message_to_revoked_key_from_contact) {
message* received_mail = slurp_message_file_into_struct("test_files/398_gabrielle_to_alice.eml");
message* decrypted_msg = NULL;
stringlist_t* keylist = NULL;
PEP_rating rating;
PEP_decrypt_flags_t flags = 0;
// We expect the app to provide user_ids wherever it has them on incoming messages, and since it breaks things
@ -619,7 +614,7 @@ TEST_F(KeyResetMessageTest, check_receive_message_to_revoked_key_from_contact) {
received_mail->to->ident->user_id = strdup(PEP_OWN_USERID);
status = decrypt_message(session, received_mail,
&decrypted_msg, &keylist, &rating, &flags);
&decrypted_msg, &keylist, &flags);
ASSERT_EQ(m_queue.size() , 1);
vector<message*>::iterator it = m_queue.begin();
@ -774,10 +769,9 @@ TEST_F(KeyResetMessageTest, check_reset_grouped_own_recv) {
message* received_mail = slurp_message_file_into_struct("test_mails/check_reset_grouped_own_recv.eml");
message* decrypted_msg = NULL;
stringlist_t* keylist = NULL;
PEP_rating rating;
PEP_decrypt_flags_t flags = 0;
status = decrypt_message(session, received_mail,
&decrypted_msg, &keylist, &rating, &flags);
&decrypted_msg, &keylist, &flags);
status = myself(session, alice);
ASSERT_OK;
@ -956,7 +950,6 @@ TEST_F(KeyResetMessageTest, check_reset_grouped_own_multi_ident_one_fpr_recv) {
// receive reset messages
message* dec_msg = NULL;
stringlist_t* keylist = NULL;
PEP_rating rating;
PEP_decrypt_flags_t flags = 0;
string fname = "test_mails/check_reset_grouped_own_multi_ident_one_fpr.eml";
@ -966,7 +959,7 @@ TEST_F(KeyResetMessageTest, check_reset_grouped_own_multi_ident_one_fpr_recv) {
ASSERT_NOTNULL(new_msg);
ASSERT_EQ(status, PEP_STATUS_OK);
status = decrypt_message(session, new_msg, &dec_msg, &keylist, &rating, &flags);
status = decrypt_message(session, new_msg, &dec_msg, &keylist, &flags);
ASSERT_EQ(status, PEP_STATUS_OK);
status = myself(session, alex_id);
@ -1440,7 +1433,6 @@ TEST_F(KeyResetMessageTest, check_reset_all_own_grouped_recv) {
// receive reset messages
message* dec_msg = NULL;
stringlist_t* keylist = NULL;
PEP_rating rating;
PEP_decrypt_flags_t flags = 0;
string fname = string("test_mails/check_reset_all_own_grouped") + to_string(i) + ".eml";
@ -1450,7 +1442,7 @@ TEST_F(KeyResetMessageTest, check_reset_all_own_grouped_recv) {
ASSERT_NOTNULL(new_msg);
ASSERT_EQ(status, PEP_STATUS_OK);
status = decrypt_message(session, new_msg, &dec_msg, &keylist, &rating, &flags);
status = decrypt_message(session, new_msg, &dec_msg, &keylist, &flags);
ASSERT_EQ(status, PEP_STATUS_OK);
}
@ -1543,7 +1535,6 @@ TEST_F(KeyResetMessageTest, check_reset_all_own_grouped_recv_with_sticky) {
// receive reset messages
message* dec_msg = NULL;
stringlist_t* keylist = NULL;
PEP_rating rating;
PEP_decrypt_flags_t flags = 0;
string fname = "test_mails/check_reset_all_own_grouped_sticky.eml";
@ -1553,7 +1544,7 @@ TEST_F(KeyResetMessageTest, check_reset_all_own_grouped_recv_with_sticky) {
ASSERT_NE(new_msg, nullptr);
ASSERT_EQ(status, PEP_STATUS_OK);
status = decrypt_message(session, new_msg, &dec_msg, &keylist, &rating, &flags);
status = decrypt_message(session, new_msg, &dec_msg, &keylist, &flags);
ASSERT_EQ(status, PEP_STATUS_OK);
char* new_main_key = NULL;
@ -1646,7 +1637,6 @@ TEST_F(KeyResetMessageTest, check_reset_grouped_own_multiple_keys_multiple_ident
// receive reset messages
message* dec_msg = NULL;
stringlist_t* keylist = NULL;
PEP_rating rating;
PEP_decrypt_flags_t flags = 0;
string fname = string("test_mails/check_reset_grouped_own_multiple_keys_multiple_idents_reset_all_") + to_string(i) + ".eml";
@ -1656,7 +1646,7 @@ TEST_F(KeyResetMessageTest, check_reset_grouped_own_multiple_keys_multiple_ident
ASSERT_NOTNULL(new_msg);
ASSERT_EQ(status, PEP_STATUS_OK);
status = decrypt_message(session, new_msg, &dec_msg, &keylist, &rating, &flags);
status = decrypt_message(session, new_msg, &dec_msg, &keylist, &flags);
ASSERT_EQ(status, PEP_STATUS_OK);
}
@ -1864,7 +1854,6 @@ TEST_F(KeyResetMessageTest, check_reset_grouped_own_multiple_keys_multiple_ident
message* dec_msg = NULL;
stringlist_t* keylist = NULL;
PEP_rating rating;
PEP_decrypt_flags_t flags = 0;
string fname = "test_mails/check_reset_grouped_own_multiple_keys_multiple_idents_reset_one.eml";
@ -1874,7 +1863,7 @@ TEST_F(KeyResetMessageTest, check_reset_grouped_own_multiple_keys_multiple_ident
ASSERT_NOTNULL(new_msg);
ASSERT_EQ(status, PEP_STATUS_OK);
status = decrypt_message(session, new_msg, &dec_msg, &keylist, &rating, &flags);
status = decrypt_message(session, new_msg, &dec_msg, &keylist, &flags);
ASSERT_EQ(status, PEP_STATUS_OK);
status = myself(session, alex_id);
@ -2644,10 +2633,9 @@ TEST_F(KeyResetMessageTest, check_no_reset_message_to_self) {
message* dec_msg = NULL;
stringlist_t* keylist = NULL;
PEP_rating rating;
PEP_decrypt_flags_t flags = 0;
status = decrypt_message(session, enc_msg, &dec_msg, &keylist, &rating, &flags);
</