test/decorate_test.cc
changeset 2461 85c8e5aad3bc
parent 1945 9503c962f746
child 2462 48b526a0daac
     1.1 --- a/test/decorate_test.cc	Mon Jan 15 12:26:14 2018 +0100
     1.2 +++ b/test/decorate_test.cc	Mon Jan 29 12:15:51 2018 +0100
     1.3 @@ -10,6 +10,7 @@
     1.4  #include <sstream>
     1.5  #include "mime.h"
     1.6  #include "message_api.h"
     1.7 +#include "test_util.h"
     1.8  
     1.9  using namespace std;
    1.10  
    1.11 @@ -24,11 +25,20 @@
    1.12      assert(session);
    1.13      cout << "init() completed.\n";
    1.14  
    1.15 -    // message_api test code
    1.16 +    const string alice_pub_key = slurp("test_keys/pub/pep-test-alice-0x6FF00E97_pub.asc");
    1.17 +    const string alice_priv_key = slurp("test_keys/priv/pep-test-alice-0x6FF00E97_priv.asc");
    1.18 +    const string bob_pub_key = slurp("test_keys/pub/pep-test-bob-0xC9C2EE39_pub.asc");
    1.19 +    PEP_STATUS statuspub = import_key(session, alice_pub_key.c_str(), alice_pub_key.length(), NULL);
    1.20 +    PEP_STATUS statuspriv = import_key(session, alice_priv_key.c_str(), alice_priv_key.length(), NULL);
    1.21 +    PEP_STATUS statusbob = import_key(session, bob_pub_key.c_str(), bob_pub_key.length(), NULL);
    1.22 +    assert(statuspub == PEP_STATUS_OK);
    1.23 +    assert(statuspriv == PEP_STATUS_OK);
    1.24 +    assert(statusbob == PEP_STATUS_OK);
    1.25  
    1.26      cout << "creating message…\n";
    1.27      pEp_identity* alice = new_identity("pep.test.alice@pep-project.org", NULL, PEP_OWN_USERID, "Alice Test");
    1.28      pEp_identity* bob = new_identity("pep.test.bob@pep-project.org", NULL, "42", "Bob Test");
    1.29 +    alice->me = true;
    1.30      identity_list* to_list = new_identity_list(bob); // to bob
    1.31      message* outgoing_message = new_message(PEP_dir_outgoing);
    1.32      assert(outgoing_message);
    1.33 @@ -45,7 +55,7 @@
    1.34      message* encrypted_msg = nullptr;
    1.35      cout << "calling encrypt_message\n";
    1.36      PEP_STATUS status = encrypt_message (session, outgoing_message, NULL, &encrypted_msg, PEP_enc_PGP_MIME, 0);
    1.37 -    cout << "encrypt_message() returns " << std::hex << status << '.' << endl;
    1.38 +    cout << "encrypt_message() returns " << tl_status_string(status) << '.' << endl;
    1.39      assert(status == PEP_STATUS_OK);
    1.40      assert(encrypted_msg);
    1.41      cout << "message encrypted.\n";