Browse Source

ENGINE-633: tests on ID collisions fixed to remove dependence on key election - need to revisit TOFU case once next week's release has happened.

ENGINE-633
parent
commit
1ff7e8e6bf
83 changed files with 1607 additions and 1546 deletions
  1. +2
    -2
      test/gen_test_skel.py
  2. +12
    -12
      test/gtest_firstpass.py
  3. +5
    -5
      test/src/AppleMailTest.cc
  4. +3
    -3
      test/src/BCCTest.cc
  5. +3
    -3
      test/src/BlacklistAcceptNewKeyTest.cc
  6. +5
    -5
      test/src/BlacklistTest.cc
  7. +5
    -5
      test/src/BloblistTest.cc
  8. +7
    -7
      test/src/CaseAndDotAddressTest.cc
  9. +22
    -22
      test/src/CheckRenewedExpiredKeyTrustStatusTest.cc
  10. +2
    -2
      test/src/CleanInvalidOwnKeysTest.cc
  11. +2
    -2
      test/src/CrashdumpTest.cc
  12. +10
    -10
      test/src/DecorateTest.cc
  13. +2
    -2
      test/src/DecryptAttachPrivateKeyTrustedTest.cc
  14. +2
    -2
      test/src/DecryptAttachPrivateKeyUntrustedTest.cc
  15. +8
    -8
      test/src/DefaultFromEmailTest.cc
  16. +22
    -22
      test/src/DeleteKeyTest.cc
  17. +12
    -12
      test/src/ElevatedAttachmentsTest.cc
  18. +65
    -65
      test/src/EmptyLongmsgFullHtmlTest.cc
  19. +9
    -9
      test/src/EncryptAttachPrivateKeyTest.cc
  20. +24
    -24
      test/src/EncryptForIdentityTest.cc
  21. +2
    -2
      test/src/EncryptMissingPrivateKeyTest.cc
  22. +4
    -4
      test/src/Engine358Test.cc
  23. +10
    -10
      test/src/Engine463Test.cc
  24. +24
    -24
      test/src/Engine514Test.cc
  25. +5
    -5
      test/src/Engine655Test.cc
  26. +6
    -6
      test/src/Engine703Test.cc
  27. +4
    -4
      test/src/Engine704Test.cc
  28. +2
    -2
      test/src/Engine715Test.cc
  29. +6
    -6
      test/src/Engine736Test.cc
  30. +28
    -16
      test/src/ExpiredSubkeyTest.cc
  31. +8
    -8
      test/src/ExportKeyTest.cc
  32. +11
    -11
      test/src/ExternalRevokeTest.cc
  33. +5
    -5
      test/src/GetKeyRatingForUserTest.cc
  34. +5
    -5
      test/src/HeaderKeyImportTest.cc
  35. +5
    -5
      test/src/I18nTest.cc
  36. +30
    -30
      test/src/IdentEncFormatTest.cc
  37. +10
    -10
      test/src/IdentityListTest.cc
  38. +34
    -34
      test/src/ImportKeyTest.cc
  39. +166
    -166
      test/src/KeyAttachmentTest.cc
  40. +2
    -2
      test/src/KeyManipulationTest.cc
  41. +184
    -184
      test/src/KeyResetMessageTest.cc
  42. +9
    -9
      test/src/KeyeditTest.cc
  43. +4
    -4
      test/src/KeyringImportTest.cc
  44. +4
    -4
      test/src/LeastColorGroupTest.cc
  45. +12
    -12
      test/src/LeastCommonDenomColorTest.cc
  46. +3
    -3
      test/src/LiteralFilenameTest.cc
  47. +7
    -7
      test/src/LookupTest.cc
  48. +7
    -7
      test/src/LotsOfKeysTest.cc
  49. +5
    -5
      test/src/MapAsn1Test.cc
  50. +63
    -63
      test/src/Message2_1Test.cc
  51. +11
    -11
      test/src/MessageApiTest.cc
  52. +5
    -5
      test/src/MessageNullFromTest.cc
  53. +14
    -14
      test/src/MessageTwoPointOhTest.cc
  54. +5
    -5
      test/src/MimeTest.cc
  55. +19
    -19
      test/src/NoOwnIdentWritesOnDecryptTest.cc
  56. +11
    -11
      test/src/OwnIdentitiesRetrieveTest.cc
  57. +76
    -76
      test/src/OwnKeysRetrieveTest.cc
  58. +115
    -115
      test/src/PassphraseTest.cc
  59. +28
    -28
      test/src/PepSubjectReceivedTest.cc
  60. +2
    -2
      test/src/PgpBinaryTest.cc
  61. +2
    -2
      test/src/PgpListKeysTest.cc
  62. +3
    -3
      test/src/Quick11to12Test.cc
  63. +90
    -90
      test/src/ReencryptPlusExtraKeysTest.cc
  64. +2
    -2
      test/src/RemoveKeyElectionTest.cc
  65. +11
    -11
      test/src/RevocationTest.cc
  66. +7
    -7
      test/src/RevokeRegenAttachTest.cc
  67. +10
    -10
      test/src/SenderFPRTest.cc
  68. +2
    -2
      test/src/SequenceTest.cc
  69. +5
    -5
      test/src/SignOnlyTest.cc
  70. +18
    -18
      test/src/SimpleBodyNotAltTest.cc
  71. +67
    -67
      test/src/StringlistTest.cc
  72. +14
    -14
      test/src/StringpairListTest.cc
  73. +10
    -10
      test/src/StrnstrTest.cc
  74. +11
    -11
      test/src/SubkeyRatingEvalTest.cc
  75. +6
    -6
      test/src/TrustManipulationTest.cc
  76. +20
    -20
      test/src/TrustwordsTest.cc
  77. +27
    -27
      test/src/URIAddressTest.cc
  78. +6
    -6
      test/src/UnencryptedPepMailTest.cc
  79. +7
    -7
      test/src/UserIDAliasTest.cc
  80. +82
    -35
      test/src/UserIdCollisionTest.cc
  81. +26
    -26
      test/src/VerifyTest.cc
  82. +6
    -4
      test/src/test_util.cc
  83. +2
    -2
      test/src/test_util.h

+ 2
- 2
test/gen_test_skel.py View File

@ -63,12 +63,12 @@ newfile.write("\n" + tb(4) + "// Leave this empty if there are no files to copy
newfile.write(tb(4) + "std::vector<std::pair<std::string, std::string>> init_files = std::vector<std::pair<std::string, std::string>>();\n")
newfile.write("\n" + tb(4) + "// Get a new test Engine.\n")
newfile.write(tb(4) + "engine = new Engine(test_path);\n");
newfile.write(tb(4) + "ASSERT_NE(engine, nullptr);\n")
newfile.write(tb(4) + "ASSERT_NOTNULL(engine);\n")
newfile.write("\n" + tb(4) + "// Ok, let's initialize test directories etc.\n")
newfile.write(tb(4) + "engine->prep(NULL, NULL, NULL, init_files);\n")
newfile.write("\n" + tb(4) + "// Ok, try to start this bugger.\n")
newfile.write(tb(4) + "engine->start();\n")
newfile.write(tb(4) + "ASSERT_NE(engine->session, nullptr);\n")
newfile.write(tb(4) + "ASSERT_NOTNULL(engine->session);\n")
newfile.write(tb(4) + "session = engine->session;\n")
newfile.write("\n" + tb(4) + "// Engine is up. Keep on truckin\'\n");
newfile.write(tb(3) + "}\n\n")


+ 12
- 12
test/gtest_firstpass.py View File

@ -94,12 +94,12 @@ for filename in os.listdir("src"):
newfile.write(tb(4) + "std::vector<std::pair<std::string, std::string>> init_files = std::vector<std::pair<std::string, std::string>>();\n")
newfile.write("\n" + tb(4) + "// Get a new test Engine.\n")
newfile.write(tb(4) + "engine = new Engine(test_path);\n");
newfile.write(tb(4) + "ASSERT_NE(engine, nullptr);\n")
newfile.write(tb(4) + "ASSERT_NOTNULL(engine);\n")
newfile.write("\n" + tb(4) + "// Ok, let's initialize test directories etc.\n")
newfile.write(tb(4) + "engine->prep(NULL, NULL, init_files);\n")
newfile.write("\n" + tb(4) + "// Ok, try to start this bugger.\n")
newfile.write(tb(4) + "engine->start();\n")
newfile.write(tb(4) + "ASSERT_NE(engine->session, nullptr);\n")
newfile.write(tb(4) + "ASSERT_NOTNULL(engine->session);\n")
newfile.write(tb(4) + "session = engine->session;\n")
newfile.write("\n" + tb(4) + "// Engine is up. Keep on truckin\'\n");
newfile.write(tb(3) + "}\n\n")
@ -159,24 +159,24 @@ for filename in os.listdir("src"):
#TEST_ASSERT_MSG(<x> == NULL, *);
#TEST_ASSERT(<x> == NULL);
# -> ASSERT_EQ(<x>, nullptr);
modline = re.sub(r'TEST_ASSERT_MSG\((.*)\s*==\s*NULL,.*\);',r'ASSERT_EQ(\1, nullptr);', line)
# -> ASSERT_NULL(<x>);
modline = re.sub(r'TEST_ASSERT_MSG\((.*)\s*==\s*NULL,.*\);',r'ASSERT_NULL(\1);', line)
if (line != modline):
newfile.write(modline + "\n")
continue
modline = re.sub(r'TEST_ASSERT\((.*)\s*==\s*NULL\);', r'ASSERT_EQ(\1, nullptr);',line)
modline = re.sub(r'TEST_ASSERT\((.*)\s*==\s*NULL\);', r'ASSERT_NULL(\1);',line)
if (line != modline):
newfile.write(modline + "\n")
continue
#TEST_ASSERT_MSG(<x> != NULL, *);
#TEST_ASSERT(<x> != NULL);
# -> ASSERT_NE(<x>, nullptr);
modline = re.sub(r'TEST_ASSERT_MSG\((.*)\s*!=\s*NULL,.*\);',r'ASSERT_NE(\1, nullptr);', line)
# -> ASSERT_NOTNULL(<x>);
modline = re.sub(r'TEST_ASSERT_MSG\((.*)\s*!=\s*NULL,.*\);',r'ASSERT_NOTNULL(\1);', line)
if (line != modline):
newfile.write(modline + "\n")
continue
modline = re.sub(r'TEST_ASSERT\((.*)\s*!=\s*NULL\);', r'ASSERT_NE(\1, nullptr);',line)
modline = re.sub(r'TEST_ASSERT\((.*)\s*!=\s*NULL\);', r'ASSERT_NOTNULL(\1);',line)
if (line != modline):
newfile.write(modline + "\n")
continue
@ -289,11 +289,11 @@ for filename in os.listdir("src"):
break;
if (is_pointer):
modline = re.sub(r'TEST_ASSERT_MSG\(!(.*),.*\);',r'ASSERT_NE(\1, nullptr);', line)
modline = re.sub(r'TEST_ASSERT_MSG\(!(.*),.*\);',r'ASSERT_NOTNULL(\1);', line)
if (line != modline):
newfile.write(modline + "\n")
continue
modline = re.sub(r'TEST_ASSERT\(!(.*)\);', r'ASSERT_NE(\1, nullptr);',line)
modline = re.sub(r'TEST_ASSERT\(!(.*)\);', r'ASSERT_NOTNULL(\1);',line)
if (line != modline):
newfile.write(modline + "\n")
continue
@ -328,11 +328,11 @@ for filename in os.listdir("src"):
break;
if (is_pointer):
modline = re.sub(r'TEST_ASSERT_MSG\((.*),.*\);',r'ASSERT_NE(\1, nullptr);', line)
modline = re.sub(r'TEST_ASSERT_MSG\((.*),.*\);',r'ASSERT_NOTNULL(\1);', line)
if (line != modline):
newfile.write(modline + "\n")
continue
modline = re.sub(r'TEST_ASSERT\((.*)\);', r'ASSERT_NE(\1, nullptr);',line)
modline = re.sub(r'TEST_ASSERT\((.*)\);', r'ASSERT_NOTNULL(\1);',line)
if (line != modline):
newfile.write(modline + "\n")
continue


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

@ -55,14 +55,14 @@ namespace {
// Get a new test Engine.
engine = new Engine(test_path);
ASSERT_NE(engine, nullptr);
ASSERT_NOTNULL(engine);
// Ok, let's initialize test directories etc.
engine->prep(NULL, NULL, NULL, init_files);
// Ok, try to start this bugger.
engine->start();
ASSERT_NE(engine->session, nullptr);
ASSERT_NOTNULL(engine->session);
session = engine->session;
// Engine is up. Keep on truckin'
@ -125,8 +125,8 @@ TEST_F(AppleMailTest, check_apple_mail_text_signed_encrypted) {
message* final_ptr = nullptr;
status = mime_decode_message(mailtext.c_str(), mailtext.length(), &msg_ptr, NULL);
ASSERT_EQ(status , PEP_STATUS_OK);
ASSERT_NE(msg_ptr, nullptr);
ASSERT_OK;
ASSERT_NOTNULL(msg_ptr);
update_identity(session, msg_ptr->from);
update_identity(session, msg_ptr->to->ident);
@ -192,7 +192,7 @@ TEST_F(AppleMailTest, check_apple_mail_html_signed_encrypted) {
status = mime_decode_message(mailtext2.c_str(), mailtext2.length(), &msg_ptr, NULL);
ASSERT_EQ(status, PEP_STATUS_OK);
ASSERT_NE(msg_ptr, nullptr);
ASSERT_NOTNULL(msg_ptr);
final_ptr = msg_ptr;
status = decrypt_message(session, msg_ptr, &dest_msg, &keylist, &rating, &flags);
final_ptr = dest_msg ? dest_msg : msg_ptr;


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

@ -52,14 +52,14 @@ namespace {
// Get a new test Engine.
engine = new Engine(test_path);
ASSERT_NE(engine, nullptr);
ASSERT_NOTNULL(engine);
// Ok, let's initialize test directories etc.
engine->prep(NULL, NULL, NULL, init_files);
// Ok, try to start this bugger.
engine->start();
ASSERT_NE(engine->session, nullptr);
ASSERT_NOTNULL(engine->session);
session = engine->session;
// Engine is up. Keep on truckin'
@ -118,7 +118,7 @@ TEST_F(BCCTest, check_single_BCC) {
ASSERT_OK;
message *msg = new_message(PEP_dir_outgoing);
ASSERT_NE(msg, nullptr);
ASSERT_NOTNULL(msg);
msg->from = sender;
// msg->to = new_identity_list(open_recip); FYI, this is supposed to fail for now. Unfortunately.
msg->bcc = new_identity_list(bcc_recip);


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

@ -55,14 +55,14 @@ namespace {
// Get a new test Engine.
engine = new Engine(test_path);
ASSERT_NE(engine, nullptr);
ASSERT_NOTNULL(engine);
// Ok, let's initialize test directories etc.
engine->prep(NULL, NULL, NULL, init_files);
// Ok, try to start this bugger.
engine->start();
ASSERT_NE(engine->session, nullptr);
ASSERT_NOTNULL(engine->session);
session = engine->session;
// Engine is up. Keep on truckin'
@ -154,7 +154,7 @@ TEST_F(BlacklistAcceptNewKeyTest, check_blacklist_accept_new_key) {
PEP_decrypt_flags_t flags = 0;
status = mime_decode_message(mailtext.c_str(), mailtext.length(), &msg_ptr, NULL);
ASSERT_EQ(status , PEP_STATUS_OK);
ASSERT_OK;
status = decrypt_message(session, msg_ptr, &dest_msg, &keylist, &rating, &flags);
// Key election is gone, but getting it via mail should set a default!


+ 5
- 5
test/src/BlacklistTest.cc View File

@ -69,14 +69,14 @@ namespace {
// Get a new test Engine.
engine = new Engine(test_path);
ASSERT_NE(engine, nullptr);
ASSERT_NOTNULL(engine);
// Ok, let's initialize test directories etc.
engine->prep(NULL, NULL, NULL, init_files);
// Ok, try to start this bugger.
engine->start();
ASSERT_NE(engine->session, nullptr);
ASSERT_NOTNULL(engine->session);
session = engine->session;
// Engine is up. Keep on truckin'
@ -119,7 +119,7 @@ TEST_F(BlacklistTest, check_blacklist) {
stringlist_t *blacklist;
PEP_STATUS status6 = blacklist_retrieve(session, &blacklist);
ASSERT_EQ(status6 , PEP_STATUS_OK);
ASSERT_NE(blacklist, nullptr);
ASSERT_NOTNULL(blacklist);
bool in23 = false;
output_stream << "the blacklist contains now: ";
@ -210,12 +210,12 @@ TEST_F(BlacklistTest, check_blacklist) {
ASSERT_TRUE(blacklisted_identity->fpr == NULL || blacklisted_identity->fpr[0] == '\0' || strcmp(blacklisted_identity->fpr, bl_fpr_2) == 0);
pEp_identity *me = new_identity("alice@peptest.ch", NULL, "423", "Alice Miller");
ASSERT_NE(me, nullptr);
ASSERT_NOTNULL(me);
PEP_STATUS status24 = myself(session, me);
ASSERT_EQ(status24 , PEP_STATUS_OK);
message *msg23 = new_message(PEP_dir_outgoing);
ASSERT_NE(msg23, nullptr);
ASSERT_NOTNULL(msg23);
msg23->from = me;
msg23->to = new_identity_list(identity_dup(blacklisted_identity));
ASSERT_TRUE(msg23->to != NULL && msg23->to->ident != NULL);


+ 5
- 5
test/src/BloblistTest.cc View File

@ -66,9 +66,9 @@ TEST_F(BloblistTest, check_bloblists) {
output_stream << "duping one-element bloblist...\n";
bloblist_t* new_bl = bloblist_dup(bl1);
ASSERT_NE(new_bl, nullptr);
ASSERT_NOTNULL(new_bl);
ASSERT_TRUE(test_bloblist_node_equals(bl1, new_bl));
ASSERT_EQ(new_bl->next , nullptr);
ASSERT_NULL(new_bl->next );
ASSERT_NE(bl1->value , new_bl->value);
ASSERT_TRUE(bl1->mime_type != new_bl->mime_type || !(bl1->mime_type || new_bl->mime_type));
ASSERT_TRUE(bl1->filename != new_bl->filename || !(bl1->filename || new_bl->filename));
@ -86,13 +86,13 @@ TEST_F(BloblistTest, check_bloblists) {
to_copy = bl_arr[i];
p = bloblist_add(new_bl, strdup(to_copy->value), to_copy->size, to_copy->mime_type, to_copy->filename);
ASSERT_NE((p), nullptr);
ASSERT_NOTNULL((p));
}
p = new_bl;
for (i = 0; i < 4; i++) {
ASSERT_NE(p, nullptr);
ASSERT_NOTNULL(p);
ASSERT_TRUE(test_bloblist_node_equals(p, bl_arr[i]));
ASSERT_TRUE(p->value != bl_arr[i]->value);
@ -101,7 +101,7 @@ TEST_F(BloblistTest, check_bloblists) {
p = p->next;
}
ASSERT_EQ(p , nullptr);
ASSERT_NULL(p );
output_stream << "\nduplicating four-element list...\n\n";
bloblist_t* duplist = bloblist_dup(new_bl);


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

@ -53,14 +53,14 @@ namespace {
// Get a new test Engine.
engine = new Engine(test_path);
ASSERT_NE(engine, nullptr);
ASSERT_NOTNULL(engine);
// Ok, let's initialize test directories etc.
engine->prep(NULL, NULL, NULL, init_files);
// Ok, try to start this bugger.
engine->start();
ASSERT_NE(engine->session, nullptr);
ASSERT_NOTNULL(engine->session);
session = engine->session;
// Engine is up. Keep on truckin'
@ -107,7 +107,7 @@ TEST_F(CaseAndDotAddressTest, check_case_and_dot_address) {
pEp_identity * new_alice_id = new_identity("pep.test.alice@pep-project.org", "4ABE3AAF59AC32CFE4F86500A9411D176FF00E97", user_id, "Alice Test");
status = update_identity(session, new_alice_id);
ASSERT_NE(new_alice_id->fpr, nullptr);
ASSERT_NOTNULL(new_alice_id->fpr);
ASSERT_STREQ(new_alice_id->fpr, "4ABE3AAF59AC32CFE4F86500A9411D176FF00E97");
free_identity(new_alice_id);
free_identity(alice_id);
@ -116,7 +116,7 @@ TEST_F(CaseAndDotAddressTest, check_case_and_dot_address) {
alice_id = new_identity(alice_email_case, NULL, user_id, "Alice Test");
status = update_identity(session, alice_id);
ASSERT_NE(alice_id->fpr, nullptr);
ASSERT_NOTNULL(alice_id->fpr);
output_stream << "Alice email: " << alice_email_case << " Alice fpr (should be 4ABE3AAF59AC32CFE4F86500A9411D176FF00E97): " << alice_id->fpr << endl;
ASSERT_STREQ(alice_id->fpr, "4ABE3AAF59AC32CFE4F86500A9411D176FF00E97");
free_identity(alice_id);
@ -124,7 +124,7 @@ TEST_F(CaseAndDotAddressTest, check_case_and_dot_address) {
alice_id = new_identity(alice_email_dot, NULL, user_id, "Alice Test");
status = update_identity(session, alice_id);
ASSERT_NE(alice_id->fpr, nullptr);
ASSERT_NOTNULL(alice_id->fpr);
output_stream << "Alice email: " << alice_email_dot << " Alice fpr (should be 4ABE3AAF59AC32CFE4F86500A9411D176FF00E97): " << alice_id->fpr << endl;
ASSERT_STREQ(alice_id->fpr, "4ABE3AAF59AC32CFE4F86500A9411D176FF00E97");
free_identity(alice_id);
@ -132,7 +132,7 @@ TEST_F(CaseAndDotAddressTest, check_case_and_dot_address) {
alice_id = new_identity(alice_email_dotless, NULL, user_id, "Alice Test");
status = update_identity(session, alice_id);
ASSERT_NE(alice_id->fpr, nullptr);
ASSERT_NOTNULL(alice_id->fpr);
output_stream << "Alice email: " << alice_email_dotless << " Alice fpr (should be 4ABE3AAF59AC32CFE4F86500A9411D176FF00E97): " << alice_id->fpr << endl;
ASSERT_STREQ(alice_id->fpr, "4ABE3AAF59AC32CFE4F86500A9411D176FF00E97");
free_identity(alice_id);
@ -140,7 +140,7 @@ TEST_F(CaseAndDotAddressTest, check_case_and_dot_address) {
alice_id = new_identity(alice_email_case_and_dot, NULL, user_id, "Alice Test");
status = update_identity(session, alice_id);
ASSERT_NE(alice_id->fpr, nullptr);
ASSERT_NOTNULL(alice_id->fpr);
output_stream << "Alice email: " << alice_email_case_and_dot << " Alice fpr (should be 4ABE3AAF59AC32CFE4F86500A9411D176FF00E97): " << alice_id->fpr << endl;
ASSERT_STREQ(alice_id->fpr, "4ABE3AAF59AC32CFE4F86500A9411D176FF00E97");
free_identity(alice_id);


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

@ -50,14 +50,14 @@ namespace {
// Get a new test Engine.
engine = new Engine(test_path);
ASSERT_NE(engine, nullptr);
ASSERT_NOTNULL(engine);
// Ok, let's initialize test directories etc.
engine->prep(NULL, NULL, NULL, init_files);
// Ok, try to start this bugger.
engine->start();
ASSERT_NE(engine->session, nullptr);
ASSERT_NOTNULL(engine->session);
session = engine->session;
// Engine is up. Keep on truckin'
@ -96,7 +96,7 @@ TEST_F(CheckRenewedExpiredKeyTrustStatusTest, check_renewed_expired_key_trust_st
pEp_identity* alice_from = new_identity("pep.test.alice@pep-project.org", alice_fpr, PEP_OWN_USERID, "Alice Cooper");
PEP_STATUS status = set_own_key(session, alice_from, alice_fpr);
ASSERT_EQ(status , PEP_STATUS_OK);
ASSERT_OK;
// Ok, so I want to make sure we make an entry, so I'll try to decrypt the message WITH
// the expired key:
@ -127,7 +127,7 @@ TEST_F(CheckRenewedExpiredKeyTrustStatusTest, check_renewed_expired_key_trust_st
msg2->attachments = new_bloblist(NULL, 0, "application/octet-stream", NULL);
status = outgoing_message_rating(session, msg2, &rating);
ASSERT_EQ(status , PEP_STATUS_OK);
ASSERT_OK;
ASSERT_EQ(rating , PEP_rating_reliable);
status = get_trust(session, expired_inquisitor);
@ -148,7 +148,7 @@ TEST_F(CheckRenewedExpiredKeyTrustStatusTest, check_renewed_expired_key_trust_st
pEp_identity* alice_from = new_identity("pep.test.alice@pep-project.org", alice_fpr, PEP_OWN_USERID, "Alice Cooper");
PEP_STATUS status = set_own_key(session, alice_from, alice_fpr);
ASSERT_EQ(status , PEP_STATUS_OK);
ASSERT_OK;
const char* inquisitor_fpr = "8E8D2381AE066ABE1FEE509821BA977CA4728718";
pEp_identity* expired_inquisitor = new_identity("inquisitor@darthmama.org", "8E8D2381AE066ABE1FEE509821BA977CA4728718", "TOFU_inquisitor@darthmama.org", "Lady Claire Trevelyan");
@ -159,10 +159,10 @@ TEST_F(CheckRenewedExpiredKeyTrustStatusTest, check_renewed_expired_key_trust_st
ASSERT_EQ(key_ct, PEP_ct_key_expired);
status = set_identity(session, expired_inquisitor);
ASSERT_EQ(status , PEP_STATUS_OK);
ASSERT_OK;
expired_inquisitor->comm_type = PEP_ct_OpenPGP; // confirmed
status = set_trust(session, expired_inquisitor);
ASSERT_EQ(status , PEP_STATUS_OK);
ASSERT_OK;
status = get_trust(session, expired_inquisitor);
ASSERT_EQ(expired_inquisitor->comm_type , PEP_ct_OpenPGP);
@ -171,12 +171,12 @@ TEST_F(CheckRenewedExpiredKeyTrustStatusTest, check_renewed_expired_key_trust_st
ASSERT_EQ(status , PEP_KEY_UNSUITABLE);
PEP_comm_type ct = expired_inquisitor->comm_type;
ASSERT_EQ(ct , PEP_ct_key_not_found);
ASSERT_EQ(expired_inquisitor->fpr, nullptr);
ASSERT_NULL(expired_inquisitor->fpr);
expired_inquisitor->fpr = strdup(inquisitor_fpr);
status = get_trust(session, expired_inquisitor);
ct = expired_inquisitor->comm_type;
ASSERT_EQ(status , PEP_STATUS_OK);
ASSERT_OK;
ASSERT_EQ(ct , PEP_ct_key_expired_but_confirmed);
// Ok, so I want to make sure we make an entry, so I'll try to decrypt the message WITH
@ -201,7 +201,7 @@ TEST_F(CheckRenewedExpiredKeyTrustStatusTest, check_renewed_expired_key_trust_st
pEp_identity* expired_inquisitor1 = new_identity("inquisitor@darthmama.org", NULL, NULL, "Lady Claire Trevelyan");
status = update_identity(session, expired_inquisitor1);
ASSERT_EQ(status , PEP_STATUS_OK);
ASSERT_OK;
status = get_trust(session, expired_inquisitor1);
ASSERT_EQ(expired_inquisitor1->comm_type , PEP_ct_OpenPGP);
@ -214,7 +214,7 @@ TEST_F(CheckRenewedExpiredKeyTrustStatusTest, check_renewed_expired_key_trust_st
msg2->attachments = new_bloblist(NULL, 0, "application/octet-stream", NULL);
status = outgoing_message_rating(session, msg2, &rating);
ASSERT_EQ(status , PEP_STATUS_OK);
ASSERT_OK;
ASSERT_GE(rating, PEP_rating_trusted);
free_message(msg2);
@ -233,15 +233,15 @@ TEST_F(CheckRenewedExpiredKeyTrustStatusTest, check_renewed_expired_key_trust_st
pEp_identity* alice_from = new_identity("pep.test.alice@pep-project.org", alice_fpr, PEP_OWN_USERID, "Alice Cooper");
PEP_STATUS status = set_own_key(session, alice_from, alice_fpr);
ASSERT_EQ(status , PEP_STATUS_OK);
ASSERT_OK;
const char* inquisitor_fpr = "8E8D2381AE066ABE1FEE509821BA977CA4728718";
pEp_identity* expired_inquisitor = new_identity("inquisitor@darthmama.org", "8E8D2381AE066ABE1FEE509821BA977CA4728718", "TOFU_inquisitor@darthmama.org", "Lady Claire Trevelyan");
status = set_identity(session, expired_inquisitor);
ASSERT_EQ(status , PEP_STATUS_OK);
ASSERT_OK;
expired_inquisitor->comm_type = PEP_ct_pEp_unconfirmed;
status = set_trust(session, expired_inquisitor);
ASSERT_EQ(status , PEP_STATUS_OK);
ASSERT_OK;
bool pEp_user = false;
status = is_pEp_user(session, expired_inquisitor, &pEp_user);
@ -277,7 +277,7 @@ TEST_F(CheckRenewedExpiredKeyTrustStatusTest, check_renewed_expired_key_trust_st
msg2->attachments = new_bloblist(NULL, 0, "application/octet-stream", NULL);
status = outgoing_message_rating(session, msg2, &rating);
ASSERT_EQ(status , PEP_STATUS_OK);
ASSERT_OK;
ASSERT_EQ(rating , PEP_rating_reliable);
status = get_trust(session, expired_inquisitor);
@ -298,21 +298,21 @@ TEST_F(CheckRenewedExpiredKeyTrustStatusTest, check_renewed_expired_key_trust_st
pEp_identity* alice_from = new_identity("pep.test.alice@pep-project.org", alice_fpr, PEP_OWN_USERID, "Alice Cooper");
PEP_STATUS status = set_own_key(session, alice_from, alice_fpr);
ASSERT_EQ(status , PEP_STATUS_OK);
ASSERT_OK;
const char* inquisitor_fpr = "8E8D2381AE066ABE1FEE509821BA977CA4728718";
pEp_identity* expired_inquisitor = new_identity("inquisitor@darthmama.org", "8E8D2381AE066ABE1FEE509821BA977CA4728718", "TOFU_inquisitor@darthmama.org", "Lady Claire Trevelyan");
status = set_identity(session, expired_inquisitor);
ASSERT_EQ(status , PEP_STATUS_OK);
ASSERT_OK;
expired_inquisitor->comm_type = PEP_ct_pEp; // confirmed
status = set_trust(session, expired_inquisitor);
ASSERT_EQ(status , PEP_STATUS_OK);
ASSERT_OK;
status = get_trust(session, expired_inquisitor);
ASSERT_EQ(expired_inquisitor->comm_type , PEP_ct_pEp);
bool pEp_user = false;
status = is_pEp_user(session, expired_inquisitor, &pEp_user);
ASSERT_EQ(status , PEP_STATUS_OK);
ASSERT_OK;
ASSERT_TRUE(pEp_user);
// Ok, now update_identity - we'll discover it's expired
@ -320,7 +320,7 @@ TEST_F(CheckRenewedExpiredKeyTrustStatusTest, check_renewed_expired_key_trust_st
ASSERT_EQ(status , PEP_KEY_UNSUITABLE);
PEP_comm_type ct = expired_inquisitor->comm_type;
ASSERT_EQ(ct, PEP_ct_key_not_found);
ASSERT_EQ(expired_inquisitor->fpr, nullptr);
ASSERT_NULL(expired_inquisitor->fpr);
expired_inquisitor->fpr = strdup(inquisitor_fpr);
status = get_trust(session, expired_inquisitor);
@ -350,7 +350,7 @@ TEST_F(CheckRenewedExpiredKeyTrustStatusTest, check_renewed_expired_key_trust_st
pEp_identity* expired_inquisitor1 = new_identity("inquisitor@darthmama.org", NULL, NULL, "Lady Claire Trevelyan");
status = update_identity(session, expired_inquisitor1);
ASSERT_EQ(status , PEP_STATUS_OK);
ASSERT_OK;
status = get_trust(session, expired_inquisitor1);
ASSERT_EQ(expired_inquisitor1->comm_type, PEP_ct_pEp);
@ -363,7 +363,7 @@ TEST_F(CheckRenewedExpiredKeyTrustStatusTest, check_renewed_expired_key_trust_st
msg2->attachments = new_bloblist(NULL, 0, "application/octet-stream", NULL);
status = outgoing_message_rating(session, msg2, &rating);
ASSERT_EQ(status , PEP_STATUS_OK);
ASSERT_OK;
ASSERT_GE(rating, PEP_rating_trusted);
free_message(msg2);


+ 2
- 2
test/src/CleanInvalidOwnKeysTest.cc View File

@ -48,14 +48,14 @@ namespace {
// Get a new test Engine.
engine = new Engine(test_path);
ASSERT_NE(engine, nullptr);
ASSERT_NOTNULL(engine);
// Ok, let's initialize test directories etc.
engine->prep(NULL, NULL, NULL, init_files);
// Ok, try to start this bugger.
engine->start();
ASSERT_NE(engine->session, nullptr);
ASSERT_NOTNULL(engine->session);
session = engine->session;
// Engine is up. Keep on truckin'


+ 2
- 2
test/src/CrashdumpTest.cc View File

@ -48,14 +48,14 @@ namespace {
// Get a new test Engine.
engine = new Engine(test_path);
ASSERT_NE(engine, nullptr);
ASSERT_NOTNULL(engine);
// Ok, let's initialize test directories etc.
engine->prep(NULL, NULL, NULL, init_files);
// Ok, try to start this bugger.
engine->start();
ASSERT_NE(engine->session, nullptr);
ASSERT_NOTNULL(engine->session);
session = engine->session;
// Engine is up. Keep on truckin'


+ 10
- 10
test/src/DecorateTest.cc View File

@ -54,14 +54,14 @@ namespace {
// Get a new test Engine.
engine = new Engine(test_path);
ASSERT_NE(engine, nullptr);
ASSERT_NOTNULL(engine);
// Ok, let's initialize test directories etc.
engine->prep(NULL, NULL, NULL, init_files);
// Ok, try to start this bugger.
engine->start();
ASSERT_NE(engine->session, nullptr);
ASSERT_NOTNULL(engine->session);
session = engine->session;
// Engine is up. Keep on truckin'
@ -105,24 +105,24 @@ TEST_F(DecorateTest, check_decorate) {
pEp_identity* alice = new_identity("pep.test.alice@pep-project.org", NULL, PEP_OWN_USERID, "Alice Test");
pEp_identity* alice_dup = identity_dup(alice);
PEP_STATUS status = set_own_key(session, alice_dup, "4ABE3AAF59AC32CFE4F86500A9411D176FF00E97");
ASSERT_EQ(status , PEP_STATUS_OK);
ASSERT_OK;
free_identity(alice_dup);
alice->me = true;
pEp_identity* bob = new_identity("pep.test.bob@pep-project.org", NULL, "42", "Bob Test");
// Set bob's key - key election removal
set_fpr_preserve_ident(session, bob, bob_fpr);
set_fpr_preserve_ident(session, bob, bob_fpr, true);
ASSERT_OK;
identity_list* to_list = new_identity_list(bob); // to bob
message* outgoing_message = new_message(PEP_dir_outgoing);
ASSERT_NE(outgoing_message, nullptr);
ASSERT_NOTNULL(outgoing_message);
outgoing_message->from = alice;
outgoing_message->to = to_list;
outgoing_message->shortmsg = strdup("Greetings, humans!");
outgoing_message->attachments = new_bloblist(NULL, 0, "application/octet-stream", NULL);
outgoing_message->longmsg = strdup("This is a dumb message.\nBut it's done.\n");
ASSERT_NE(outgoing_message->longmsg, nullptr);
ASSERT_NOTNULL(outgoing_message->longmsg);
output_stream << "message created.\n";
char* encoded_text = nullptr;
@ -131,13 +131,13 @@ TEST_F(DecorateTest, check_decorate) {
output_stream << "calling encrypt_message\n";
status = encrypt_message (session, outgoing_message, NULL, &encrypted_msg, PEP_enc_PGP_MIME, 0);
output_stream << "encrypt_message() returns " << tl_status_string(status) << '.' << endl;
ASSERT_EQ(status , PEP_STATUS_OK);
ASSERT_NE(encrypted_msg, nullptr);
ASSERT_OK;
ASSERT_NOTNULL(encrypted_msg);
output_stream << "message encrypted.\n";
status = mime_encode_message(encrypted_msg, false, &encoded_text, false);
ASSERT_EQ(status , PEP_STATUS_OK);
ASSERT_NE(encoded_text, nullptr);
ASSERT_OK;
ASSERT_NOTNULL(encoded_text);
bool contains_version = false;


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

@ -56,14 +56,14 @@ namespace {
// Get a new test Engine.
engine = new Engine(test_path);
ASSERT_NE(engine, nullptr);
ASSERT_NOTNULL(engine);
// Ok, let's initialize test directories etc.
engine->prep(NULL, NULL, NULL, init_files);
// Ok, try to start this bugger.
engine->start();
ASSERT_NE(engine->session, nullptr);
ASSERT_NOTNULL(engine->session);
session = engine->session;
// Engine is up. Keep on truckin'


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

@ -54,14 +54,14 @@ namespace {
// Get a new test Engine.
engine = new Engine(test_path);
ASSERT_NE(engine, nullptr);
ASSERT_NOTNULL(engine);
// Ok, let's initialize test directories etc.
engine->prep(NULL, NULL, NULL, init_files);
// Ok, try to start this bugger.
engine->start();
ASSERT_NE(engine->session, nullptr);
ASSERT_NOTNULL(engine->session);
session = engine->session;
// Engine is up. Keep on truckin'


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

@ -45,14 +45,14 @@ namespace {
// Get a new test Engine.
engine = new Engine(test_path);
ASSERT_NE(engine, nullptr);
ASSERT_NOTNULL(engine);
// Ok, let's initialize test directories etc.
engine->prep(NULL, NULL, NULL, init_files);
// Ok, try to start this bugger.
engine->start();
ASSERT_NE(engine->session, nullptr);
ASSERT_NOTNULL(engine->session);
session = engine->session;
// Engine is up. Keep on truckin'
@ -132,7 +132,7 @@ TEST_F(DefaultFromEmailTest, check_encrypt_to_OpenPGP_simple_key) {
status = encrypt_message(session, unenc_msg, NULL, &enc_msg, PEP_enc_PEP, 0);
ASSERT_OK;
ASSERT_NE(enc_msg, nullptr);
ASSERT_NOTNULL(enc_msg);
// N.B. Actual check happens on decrypt later. But we can check that the encryption path doesn't fail, anyway.
if (DEFAULT_FROM_TEST_GEN) {
@ -156,7 +156,7 @@ TEST_F(DefaultFromEmailTest, check_encrypt_to_pEp_1_0_simple_key) {
status = encrypt_message(session, unenc_msg, NULL, &enc_msg, PEP_enc_PEP, 0);
ASSERT_OK;
ASSERT_NE(enc_msg, nullptr);
ASSERT_NOTNULL(enc_msg);
// N.B. Actual check happens on decrypt later. But we can check that the encryption path doesn't fail, anyway.
if (DEFAULT_FROM_TEST_GEN) {
@ -180,7 +180,7 @@ TEST_F(DefaultFromEmailTest, check_encrypt_to_pEp_2_0_simple_key) {
status = encrypt_message(session, unenc_msg, NULL, &enc_msg, PEP_enc_PEP, 0);
ASSERT_OK;
ASSERT_NE(enc_msg, nullptr);
ASSERT_NOTNULL(enc_msg);
// N.B. Actual check happens on decrypt later. But we can check that the encryption path doesn't fail, anyway.
if (DEFAULT_FROM_TEST_GEN) {
@ -204,7 +204,7 @@ TEST_F(DefaultFromEmailTest, check_encrypt_to_pEp_2_1_simple_key) {
status = encrypt_message(session, unenc_msg, NULL, &enc_msg, PEP_enc_PEP, 0);
ASSERT_OK;
ASSERT_NE(enc_msg, nullptr);
ASSERT_NOTNULL(enc_msg);
// N.B. Actual check happens on decrypt later. But we can check that the encryption path doesn't fail, anyway.
if (DEFAULT_FROM_TEST_GEN) {
@ -228,7 +228,7 @@ TEST_F(DefaultFromEmailTest, check_encrypt_to_pEp_2_2_simple_key) {
status = encrypt_message(session, unenc_msg, NULL, &enc_msg, PEP_enc_PEP, 0);
ASSERT_OK;
ASSERT_NE(enc_msg, nullptr);
ASSERT_NOTNULL(enc_msg);
// N.B. Actual check happens on decrypt later. But we can check that the encryption path doesn't fail, anyway.
if (DEFAULT_FROM_TEST_GEN) {
@ -252,7 +252,7 @@ TEST_F(DefaultFromEmailTest, check_encrypt_to_pEp_10_111_simple_key) {
status = encrypt_message(session, unenc_msg, NULL, &enc_msg, PEP_enc_PEP, 0);
ASSERT_OK;
ASSERT_NE(enc_msg, nullptr);
ASSERT_NOTNULL(enc_msg);
// N.B. Actual check happens on decrypt later. But we can check that the encryption path doesn't fail, anyway.
if (DEFAULT_FROM_TEST_GEN) {


+ 22
- 22
test/src/DeleteKeyTest.cc View File

@ -64,14 +64,14 @@ namespace {
// Get a new test Engine.
engine = new Engine(test_path);
ASSERT_NE(engine, nullptr);
ASSERT_NOTNULL(engine);
// Ok, let's initialize test directories etc.
engine->prep(NULL, NULL, NULL, init_files);
// Ok, try to start this bugger.
engine->start();
ASSERT_NE(engine->session, nullptr);
ASSERT_NOTNULL(engine->session);
session = engine->session;
// Engine is up. Keep on truckin'
@ -99,35 +99,35 @@ namespace {
status = set_up_ident_from_scratch(session,
"test_keys/pub/pep-test-bob-0xC9C2EE39_pub.asc",
"pep.test.bob@pep-project.org", NULL, bob_user_id.c_str(), "Bob's Burgers",
"pep.test.bob@pep-project.org", bob_fpr, bob_user_id.c_str(), "Bob's Burgers",
NULL, false
);
assert(status == PEP_STATUS_OK);
status = set_up_ident_from_scratch(session,
"test_keys/pub/pep-test-carol-0x42A85A42_pub.asc",
"pep-test-carol@pep-project.org", NULL, carol_user_id.c_str(), "Carol Burnett",
"pep-test-carol@pep-project.org", carol_fpr, carol_user_id.c_str(), "Carol Burnett",
NULL, false
);
assert(status == PEP_STATUS_OK);
status = set_up_ident_from_scratch(session,
"test_keys/pub/pep-test-dave-0xBB5BCCF6_pub.asc",
"pep-test-dave@pep-project.org", NULL, dave_user_id.c_str(),
"pep-test-dave@pep-project.org", dave_fpr, dave_user_id.c_str(),
"David Hasselhoff (Germans Love Me)", NULL, false
);
assert(status == PEP_STATUS_OK);
status = set_up_ident_from_scratch(session,
"test_keys/pub/pep-test-erin-0x9F8D7CBA_pub.asc",
"pep-test-erin@pep-project.org", NULL, erin_user_id.c_str(),
"pep-test-erin@pep-project.org", erin_fpr, erin_user_id.c_str(),
"Éirinn go Brách", NULL, false
);
assert(status == PEP_STATUS_OK);
status = set_up_ident_from_scratch(session,
"test_keys/pub/pep.test.fenris-0x4F3D2900_pub.asc",
"pep.test.fenris@thisstilldoesntwork.lu", NULL, fenris_user_id.c_str(),
"pep.test.fenris@thisstilldoesntwork.lu", fenris_fpr, fenris_user_id.c_str(),
"Fenris Leto Hawke", NULL, false
);
assert(status == PEP_STATUS_OK);
@ -163,7 +163,7 @@ TEST_F(DeleteKeyTest, check_delete_single_pubkey) {
// Is it gone?
status = find_keys(session, fenris_fpr, &keylist);
ASSERT_EQ(status, PEP_STATUS_OK);
ASSERT_EQ(keylist, nullptr);
ASSERT_NULL(keylist);
// Yay.
}
@ -187,7 +187,7 @@ TEST_F(DeleteKeyTest, check_delete_pub_priv_keypair) {
// Is it gone?
status = find_keys(session, alice_fpr, &keylist);
ASSERT_EQ(status, PEP_STATUS_OK);
ASSERT_EQ(keylist, nullptr);
ASSERT_NULL(keylist);
// Yay.
}
@ -231,15 +231,15 @@ TEST_F(DeleteKeyTest, check_delete_multiple_keys) {
// Is it gone?
status = find_keys(session, alice_fpr, &keylist);
ASSERT_EQ(status, PEP_STATUS_OK);
ASSERT_EQ(keylist, nullptr);
ASSERT_NULL(keylist);
status = find_keys(session, dave_fpr, &keylist);
ASSERT_EQ(status, PEP_STATUS_OK);
ASSERT_EQ(keylist, nullptr);
ASSERT_NULL(keylist);
status = find_keys(session, fenris_fpr, &keylist);
ASSERT_EQ(status, PEP_STATUS_OK);
ASSERT_EQ(keylist, nullptr);
ASSERT_NULL(keylist);
// Yay. Make sure everyone else is still there.
status = find_keys(session, bob_fpr, &keylist);
@ -333,37 +333,37 @@ TEST_F(DeleteKeyTest, check_delete_all_keys) {
// Is it gone?
status = find_keys(session, alice_fpr, &keylist);
ASSERT_EQ(status, PEP_STATUS_OK);
ASSERT_EQ(keylist, nullptr);
ASSERT_NULL(keylist);
free_stringlist(keylist);
keylist = NULL;
status = find_keys(session, bob_fpr, &keylist);
ASSERT_EQ(status, PEP_STATUS_OK);
ASSERT_EQ(keylist, nullptr);
ASSERT_NULL(keylist);
free_stringlist(keylist);
keylist = NULL;
status = find_keys(session, carol_fpr, &keylist);
ASSERT_EQ(status, PEP_STATUS_OK);
ASSERT_EQ(keylist, nullptr);
ASSERT_NULL(keylist);
free_stringlist(keylist);
keylist = NULL;
status = find_keys(session, dave_fpr, &keylist);
ASSERT_EQ(status, PEP_STATUS_OK);
ASSERT_EQ(keylist, nullptr);
ASSERT_NULL(keylist);
free_stringlist(keylist);
keylist = NULL;
status = find_keys(session, erin_fpr, &keylist);
ASSERT_EQ(status, PEP_STATUS_OK);
ASSERT_EQ(keylist, nullptr);
ASSERT_NULL(keylist);
free_stringlist(keylist);
keylist = NULL;
status = find_keys(session, fenris_fpr, &keylist);
ASSERT_EQ(status, PEP_STATUS_OK);
ASSERT_EQ(keylist, nullptr);
ASSERT_NULL(keylist);
free_stringlist(keylist);
keylist = NULL;
@ -377,7 +377,7 @@ TEST_F(DeleteKeyTest, check_delete_key_not_found) {
// Is it there?
PEP_STATUS status = find_keys(session, "74D79B4496E289BD8A71B70BA8E2C4530019697D", &keylist);
ASSERT_EQ(status, PEP_STATUS_OK);
ASSERT_EQ(keylist, nullptr);
ASSERT_NULL(keylist);
free_stringlist(keylist);
keylist = NULL;
@ -388,7 +388,7 @@ TEST_F(DeleteKeyTest, check_delete_key_not_found) {
// Is it still gone?
status = find_keys(session, "74D79B4496E289BD8A71B70BA8E2C4530019697D", &keylist);
ASSERT_EQ(status, PEP_STATUS_OK);
ASSERT_EQ(keylist, nullptr);
ASSERT_NULL(keylist);
free_stringlist(keylist);
keylist = NULL;
@ -401,7 +401,7 @@ TEST_F(DeleteKeyTest, check_delete_empty_keyring) {
// Is it there?
PEP_STATUS status = find_keys(session, "74D79B4496E289BD8A71B70BA8E2C4530019697D", &keylist);
ASSERT_EQ(status, PEP_STATUS_OK);
ASSERT_EQ(keylist, nullptr);
ASSERT_NULL(keylist);
free_stringlist(keylist);
keylist = NULL;
@ -412,7 +412,7 @@ TEST_F(DeleteKeyTest, check_delete_empty_keyring) {
// Is it still gone?
status = find_keys(session, "74D79B4496E289BD8A71B70BA8E2C4530019697D", &keylist);
ASSERT_EQ(status, PEP_STATUS_OK);
ASSERT_EQ(keylist, nullptr);
ASSERT_NULL(keylist);
free_stringlist(keylist);
keylist = NULL;


+ 12
- 12
test/src/ElevatedAttachmentsTest.cc View File

@ -45,14 +45,14 @@ namespace {
// Get a new test Engine.
engine = new Engine(test_path);
ASSERT_NE(engine, nullptr);
ASSERT_NOTNULL(engine);
// Ok, let's initialize test directories etc.
engine->prep(NULL, NULL, NULL, init_files);
// Ok, try to start this bugger.
engine->start();
ASSERT_NE(engine->session, nullptr);
ASSERT_NOTNULL(engine->session);
session = engine->session;
// Engine is up. Keep on truckin'
@ -203,19 +203,19 @@ TEST_F(ElevatedAttachmentsTest, check_encrypt_decrypt_message) {
"pep.test.alice@pep-project.org", alice_fpr,
PEP_OWN_USERID, "Alice in Wonderland", NULL, true
);
ASSERT_EQ(status , PEP_STATUS_OK);
ASSERT_OK;
ASSERT_TRUE(slurp_and_import_key(session, "test_keys/pub/pep-test-bob-0xC9C2EE39_pub.asc"));
message* msg = new_message(PEP_dir_outgoing);
pEp_identity* alice = new_identity("pep.test.alice@pep-project.org", NULL, PEP_OWN_USERID, NULL);
pEp_identity* bob = new_identity("pep.test.bob@pep-project.org", NULL, "Bob", NULL);
status = myself(session, alice);
ASSERT_EQ(status , PEP_STATUS_OK);
ASSERT_OK;
status = update_identity(session, bob);
ASSERT_EQ(status , PEP_STATUS_OK);
ASSERT_OK;
status = set_as_pEp_user(session, bob);
ASSERT_EQ(status , PEP_STATUS_OK);
ASSERT_OK;
msg->to = new_identity_list(bob);
msg->from = alice;
@ -230,7 +230,7 @@ TEST_F(ElevatedAttachmentsTest, check_encrypt_decrypt_message) {
message* enc_msg = NULL;
status = encrypt_message(session, msg, NULL, &enc_msg, PEP_enc_inline, 0);
ASSERT_EQ(status , PEP_STATUS_OK);
ASSERT_OK;
// .shortmsg will stay unencrypted
ASSERT_STREQ(msg->shortmsg, enc_msg->shortmsg);
@ -298,19 +298,19 @@ TEST_F(ElevatedAttachmentsTest, check_encrypt_decrypt_message_elevated) {
"pep.test.alice@pep-project.org", alice_fpr,
PEP_OWN_USERID, "Alice in Wonderland", NULL, true
);
ASSERT_EQ(status , PEP_STATUS_OK);
ASSERT_OK;
ASSERT_TRUE(slurp_and_import_key(session, "test_keys/pub/pep-test-bob-0xC9C2EE39_pub.asc"));
message* msg = new_message(PEP_dir_outgoing);
pEp_identity* alice = new_identity("pep.test.alice@pep-project.org", NULL, PEP_OWN_USERID, NULL);
pEp_identity* bob = new_identity("pep.test.bob@pep-project.org", NULL, "Bob", NULL);
status = myself(session, alice);
ASSERT_EQ(status , PEP_STATUS_OK);
ASSERT_OK;
status = update_identity(session, bob);
ASSERT_EQ(status , PEP_STATUS_OK);
ASSERT_OK;
status = set_as_pEp_user(session, bob);
ASSERT_EQ(status , PEP_STATUS_OK);
ASSERT_OK;
msg->to = new_identity_list(bob);
msg->from = alice;
@ -325,7 +325,7 @@ TEST_F(ElevatedAttachmentsTest, check_encrypt_decrypt_message_elevated) {
message* enc_msg = NULL;
status = encrypt_message(session, msg, NULL, &enc_msg, PEP_enc_inline_EA, 0);
ASSERT_EQ(status , PEP_STATUS_OK);
ASSERT_OK;
// .longmsg will go encrypted
ASSERT_TRUE(is_PGP_message_text(enc_msg->longmsg));


+ 65
- 65
test/src/EmptyLongmsgFullHtmlTest.cc View File

@ -49,14 +49,14 @@ namespace {
// Get a new test Engine.
engine = new Engine(test_path);
ASSERT_NE(engine, nullptr);
ASSERT_NOTNULL(engine);
// Ok, let's initialize test directories etc.
engine->prep(NULL, NULL, NULL, init_files);
// Ok, try to start this bugger.
engine->start();
ASSERT_NE(engine->session, nullptr);
ASSERT_NOTNULL(engine->session);
session = engine->session;
// Engine is up. Keep on truckin'
@ -159,7 +159,7 @@ TEST_F(EmptyLongmsgFullHtmlTest, check_empty_longmsg_full_html_text_att) {
char* outmsg = NULL;
mime_encode_message(msg, false, &outmsg, false);
ASSERT_EQ(strstr(outmsg, "alternative"), nullptr);
ASSERT_NULL(strstr(outmsg, "alternative"));
cout << outmsg << endl;
@ -185,9 +185,9 @@ TEST_F(EmptyLongmsgFullHtmlTest, check_empty_longmsg_full_html_html_att) {
char* outmsg = NULL;
mime_encode_message(msg, false, &outmsg, false);
ASSERT_EQ(strstr(outmsg, "alternative"), nullptr);
ASSERT_EQ(strstr(outmsg, "related"), nullptr);
ASSERT_NE(strstr(outmsg, "mixed"), nullptr);
ASSERT_NULL(strstr(outmsg, "alternative"));
ASSERT_NULL(strstr(outmsg, "related"));
ASSERT_NOTNULL(strstr(outmsg, "mixed"));
cout << outmsg << endl;
@ -216,24 +216,24 @@ TEST_F(EmptyLongmsgFullHtmlTest, check_empty_longmsg_full_html_text_html_atts) {
mime_encode_message(msg, false, &outmsg, false);
// Could do more here, but honestly, these are just sanity checks, as mostly this is getting checked by inspection
ASSERT_EQ(strstr(outmsg, "alternative"), nullptr);
ASSERT_EQ(strstr(outmsg, "related"), nullptr);
ASSERT_NE(strstr(outmsg, "mixed"), nullptr);
ASSERT_NULL(strstr(outmsg, "alternative"));
ASSERT_NULL(strstr(outmsg, "related"));
ASSERT_NOTNULL(strstr(outmsg, "mixed"));
cout << outmsg << endl;
const char* body_html_text = strstr(outmsg, "HTML Mail");
ASSERT_NE(body_html_text, nullptr);
ASSERT_NOTNULL(body_html_text);
const char* att_html_text = strstr(body_html_text + 1, "Warning");
ASSERT_GT(att_html_text, body_html_text);
const char* chkstr = strstr(outmsg, "Content-Disposition: attachment");
ASSERT_NE(chkstr, nullptr);
ASSERT_NOTNULL(chkstr);
chkstr = strstr(chkstr + strlen("Content-Disposition: attachment"), "Content-Disposition: attachment");
ASSERT_NE(chkstr, nullptr);
ASSERT_NOTNULL(chkstr);
chkstr = strstr(chkstr + strlen("Content-Disposition: attachment"), "Content-Disposition: attachment");
ASSERT_EQ(chkstr, nullptr);
ASSERT_NULL(chkstr);
}
@ -260,20 +260,20 @@ TEST_F(EmptyLongmsgFullHtmlTest, check_empty_longmsg_full_html_html_text_atts) {
cout << outmsg << endl;
// Could do more here, but honestly, these are just sanity checks, as mostly this is getting checked by inspection
ASSERT_EQ(strstr(outmsg, "alternative"), nullptr);
ASSERT_EQ(strstr(outmsg, "related"), nullptr);
ASSERT_NE(strstr(outmsg, "mixed"), nullptr);
ASSERT_NULL(strstr(outmsg, "alternative"));
ASSERT_NULL(strstr(outmsg, "related"));
ASSERT_NOTNULL(strstr(outmsg, "mixed"));
const char* body_html_text = strstr(outmsg, "HTML Mail");
ASSERT_NE(body_html_text, nullptr);
ASSERT_NOTNULL(body_html_text);
const char* att_html_text = strstr(body_html_text + 1, "Warning");
ASSERT_GT(att_html_text, body_html_text);
const char* chkstr = strstr(outmsg, "Content-Disposition: attachment");
ASSERT_NE(chkstr, nullptr);
ASSERT_NOTNULL(chkstr);
chkstr = strstr(chkstr + strlen("Content-Disposition: attachment"), "Content-Disposition: attachment");
ASSERT_NE(chkstr, nullptr);
ASSERT_NOTNULL(chkstr);
chkstr = strstr(chkstr + strlen("Content-Disposition: attachment"), "Content-Disposition: attachment");
ASSERT_EQ(chkstr, nullptr);
ASSERT_NULL(chkstr);
}
@ -340,9 +340,9 @@ TEST_F(EmptyLongmsgFullHtmlTest, check_empty_longmsg_full_html_text_inline_att)
char* outmsg = NULL;
mime_encode_message(msg, false, &outmsg, false);
ASSERT_EQ(strstr(outmsg, "alternative"), nullptr);
ASSERT_NE(strstr(outmsg, "related"), nullptr);
ASSERT_EQ(strstr(outmsg, "Content-Disposition: attachment"), nullptr);
ASSERT_NULL(strstr(outmsg, "alternative"));
ASSERT_NOTNULL(strstr(outmsg, "related"));
ASSERT_NULL(strstr(outmsg, "Content-Disposition: attachment"));
cout << outmsg << endl;
@ -390,11 +390,11 @@ TEST_F(EmptyLongmsgFullHtmlTest, check_empty_longmsg_full_html_text_inline_att_p
char* outmsg = NULL;
mime_encode_message(msg, false, &outmsg, false);
ASSERT_EQ(strstr(outmsg, "alternative"), nullptr);
ASSERT_NE(strstr(outmsg, "related"), nullptr);
ASSERT_NE(strstr(outmsg, "mixed"), nullptr);
ASSERT_NE(strstr(outmsg, "Content-ID: <part1.21156198.7E41C8BF@darthmama.org>"), nullptr);
ASSERT_NE(strstr(outmsg, "Content-Disposition: attachment; filename=\"meow.jpg\""), nullptr);
ASSERT_NULL(strstr(outmsg, "alternative"));
ASSERT_NOTNULL(strstr(outmsg, "related"));
ASSERT_NOTNULL(strstr(outmsg, "mixed"));
ASSERT_NOTNULL(strstr(outmsg, "Content-ID: <part1.21156198.7E41C8BF@darthmama.org>"));
ASSERT_NOTNULL(strstr(outmsg, "Content-Disposition: attachment; filename=\"meow.jpg\""));
cout << outmsg << endl;
}
@ -405,10 +405,10 @@ TEST_F(EmptyLongmsgFullHtmlTest, check_parse_simple_html_only) {
int size = 0;
mime_decode_message(msg_str.c_str(), msg_str.size(), &msg, NULL);
ASSERT_NE(msg, nullptr);
ASSERT_EQ(msg->longmsg, nullptr);
ASSERT_NE(msg->longmsg_formatted, nullptr);
ASSERT_EQ(msg->attachments, nullptr);
ASSERT_NOTNULL(msg);
ASSERT_NULL(msg->longmsg);
ASSERT_NOTNULL(msg->longmsg_formatted);
ASSERT_NULL(msg->attachments);
cout << msg->longmsg_formatted << endl;
}
@ -419,14 +419,14 @@ TEST_F(EmptyLongmsgFullHtmlTest, check_parse_simple_html_text_attachment) {
int size = 0;
mime_decode_message(msg_str.c_str(), msg_str.size(), &msg, NULL);
ASSERT_NE(msg, nullptr);
ASSERT_EQ(msg->longmsg, nullptr);
ASSERT_NE(msg->longmsg_formatted, nullptr);
ASSERT_NE(msg->attachments, nullptr);
ASSERT_NOTNULL(msg);
ASSERT_NULL(msg->longmsg);
ASSERT_NOTNULL(msg->longmsg_formatted);
ASSERT_NOTNULL(msg->attachments);
ASSERT_STREQ(msg->attachments->mime_type, "text/plain");
string att_txt = "Your mother was a hamster\nAnd your father smelt of elterberries";
ASSERT_EQ(memcmp(att_txt.c_str(), msg->attachments->value, att_txt.size()), 0);
ASSERT_EQ(msg->attachments->next, nullptr);
ASSERT_NULL(msg->attachments->next);
cout << msg->longmsg_formatted << endl;
}
@ -436,18 +436,18 @@ TEST_F(EmptyLongmsgFullHtmlTest, check_parse_simple_html_text_html_attachment) {
int size = 0;
mime_decode_message(msg_str.c_str(), msg_str.size(), &msg, NULL);
ASSERT_NE(msg, nullptr);
ASSERT_EQ(msg->longmsg, nullptr);
ASSERT_NE(msg->longmsg_formatted, nullptr);
ASSERT_NE(msg->attachments, nullptr);
ASSERT_NOTNULL(msg);
ASSERT_NULL(msg->longmsg);
ASSERT_NOTNULL(msg->longmsg_formatted);
ASSERT_NOTNULL(msg->attachments);
ASSERT_STREQ(msg->attachments->mime_type, "text/plain");
string att_txt = "\nBAH.\n";
ASSERT_EQ(memcmp(att_txt.c_str(), msg->attachments->value, att_txt.size()), 0);
ASSERT_NE(msg->attachments->next, nullptr);
ASSERT_NOTNULL(msg->attachments->next);
ASSERT_STREQ(msg->attachments->next->mime_type, "text/html");
string html_txt = "<html>\n<body>\n<h1>HTML Mail is For Losers</h1>\n<p>But people use it.</p>\n</body>\n</html>\n";
ASSERT_EQ(memcmp(html_txt.c_str(), msg->attachments->next->value, html_txt.size()), 0);
ASSERT_EQ(msg->attachments->next->next, nullptr);
ASSERT_NULL(msg->attachments->next->next);
}
@ -457,17 +457,17 @@ TEST_F(EmptyLongmsgFullHtmlTest, check_parse_simple_html_html_text_attachment) {
int size = 0;
mime_decode_message(msg_str.c_str(), msg_str.size(), &msg, NULL);
ASSERT_EQ(msg->longmsg, nullptr);
ASSERT_NE(msg->longmsg_formatted, nullptr);
ASSERT_NE(msg->attachments, nullptr);
ASSERT_NE(msg->attachments->next, nullptr);
ASSERT_NULL(msg->longmsg);
ASSERT_NOTNULL(msg->longmsg_formatted);
ASSERT_NOTNULL(msg->attachments);
ASSERT_NOTNULL(msg->attachments->next);
ASSERT_STREQ(msg->attachments->mime_type, "text/html");
string att_txt = "\nBAH.\n";
string html_txt = "<html>\n<body>\n<h1>HTML Mail is For Losers</h1>\n<p>But people use it.</p>\n</body>\n</html>\n";
ASSERT_EQ(memcmp(html_txt.c_str(), msg->attachments->value, html_txt.size()), 0);
ASSERT_STREQ(msg->attachments->next->mime_type, "text/plain");
ASSERT_EQ(memcmp(att_txt.c_str(), msg->attachments->next->value, att_txt.size()), 0);
ASSERT_EQ(msg->attachments->next->next, nullptr);
ASSERT_NULL(msg->attachments->next->next);
}
@ -477,10 +477,10 @@ TEST_F(EmptyLongmsgFullHtmlTest, check_parse_simple_inline_html) {
int size = 0;
mime_decode_message(msg_str.c_str(), msg_str.size(), &msg, NULL);
ASSERT_NE(msg, nullptr);
ASSERT_EQ(msg->longmsg, nullptr);
ASSERT_NE(msg->longmsg_formatted, nullptr);
ASSERT_NE(msg->attachments, nullptr);
ASSERT_NOTNULL(msg);
ASSERT_NULL(msg->longmsg);
ASSERT_NOTNULL(msg->longmsg_formatted);
ASSERT_NOTNULL(msg->attachments);
ASSERT_STREQ(msg->attachments->mime_type, "image/jpeg");
int retval = 0;
@ -504,7 +504,7 @@ TEST_F(EmptyLongmsgFullHtmlTest, check_parse_simple_inline_html) {
ASSERT_EQ(memcmp(img, msg->attachments->value, msg->attachments->size), 0);
ASSERT_EQ(msg->attachments->disposition, PEP_CONTENT_DISP_INLINE);
ASSERT_EQ(msg->attachments->next, nullptr);
ASSERT_NULL(msg->attachments->next);
cout << msg->longmsg_formatted << endl;
}
@ -514,14 +514,14 @@ TEST_F(EmptyLongmsgFullHtmlTest, check_parse_inline_html_text_attachment) {
int size = 0;
mime_decode_message(msg_str.c_str(), msg_str.size(), &msg, NULL);