Added key imports to fix test fail
authorKrista Grothoff <krista@pep-project.org>
Wed, 18 Jan 2017 14:41:16 +0100
changeset 154542f8c8f29df3
parent 1544 59ebfba16240
child 1546 06560cae1d20
Added key imports to fix test fail
test/apple_mail_test.cc
     1.1 --- a/test/apple_mail_test.cc	Wed Jan 18 13:04:00 2017 +0100
     1.2 +++ b/test/apple_mail_test.cc	Wed Jan 18 14:41:16 2017 +0100
     1.3 @@ -13,6 +13,7 @@
     1.4  
     1.5  int main(int argc, char** argv) {
     1.6      
     1.7 +
     1.8      const char* mailfile = "test_mails/apple_mail_TC_signed_encrypted.eml";
     1.9      
    1.10      PEP_SESSION session;
    1.11 @@ -23,6 +24,26 @@
    1.12      assert(session);
    1.13      cout << "init() completed.\n";
    1.14  
    1.15 +    ifstream infilekey1("test_keys/pub/pep-test-apple-0x1CCBC7D7_pub.asc");
    1.16 +    string keytextkey1;
    1.17 +    while (!infilekey1.eof()) {
    1.18 +        static string line;
    1.19 +        getline(infilekey1, line);
    1.20 +        keytextkey1 += line + "\n";
    1.21 +    }
    1.22 +    infilekey1.close(); 
    1.23 +    
    1.24 +    ifstream infilekey2("test_keys/priv/pep-test-recip-0x08DB0AEE_priv.asc");
    1.25 +    string keytextkey2;
    1.26 +    while (!infilekey2.eof()) {
    1.27 +        static string line;
    1.28 +        getline(infilekey2, line);
    1.29 +        keytextkey2 += line + "\n";
    1.30 +    }
    1.31 +    infilekey2.close(); 
    1.32 +
    1.33 +    PEP_STATUS statuskey1 = import_key(session, keytextkey1.c_str(), keytextkey1.length(), NULL);
    1.34 +    PEP_STATUS statuskey2 = import_key(session, keytextkey2.c_str(), keytextkey2.length(), NULL);
    1.35          
    1.36      ifstream infile(mailfile);
    1.37      string mailtext;
    1.38 @@ -105,7 +126,12 @@
    1.39      free_message(msg_ptr);
    1.40      free_stringlist(keylist);
    1.41  
    1.42 -    
    1.43 +    msg_ptr = nullptr;
    1.44 +    dest_msg = nullptr;
    1.45 +    final_ptr = nullptr;
    1.46 +    keylist = nullptr;
    1.47 +    rating = PEP_rating_unreliable;
    1.48 +        
    1.49      cout << "calling release()\n";
    1.50      release(session);
    1.51      return 0;