More testing. ENGINE-559
authorKrista 'DarthMama' Bennett <krista@pep.foundation>
Mon, 15 Jul 2019 15:29:06 +0200
branchENGINE-559
changeset 39264b83788c7a45
parent 3919 0700d69d0210
child 3943 47d45beb5cd1
More testing.
test/src/engine_tests/Message2_1Tests.cc
     1.1 --- a/test/src/engine_tests/Message2_1Tests.cc	Tue Jul 09 12:50:59 2019 +0200
     1.2 +++ b/test/src/engine_tests/Message2_1Tests.cc	Mon Jul 15 15:29:06 2019 +0200
     1.3 @@ -251,12 +251,50 @@
     1.4  }
     1.5  
     1.6  void Message2_1Tests::check_message2_1_recip_1_0_from_msg_OpenPGP() {
     1.7 +    pEp_identity* alice = NULL;
     1.8 +    
     1.9 +    PEP_STATUS status = set_up_preset(session, ALICE, 
    1.10 +                                      true, true, true, true, true, &alice);
    1.11 +
    1.12 +    TEST_ASSERT(status == PEP_STATUS_OK);
    1.13 +    TEST_ASSERT(alice);
    1.14 +
    1.15      // receive 1.0 message from OpenPGP
    1.16 +    string incoming = slurp("test_mails/From_M1_0.eml");
    1.17 +    
    1.18 +    char* dec_msg;
    1.19 +    char* mod_src;
    1.20 +    PEP_decrypt_flags_t flags = 0;
    1.21 +    stringlist_t* keylist_used = NULL;
    1.22 +    PEP_rating rating;
    1.23 +    
    1.24 +    status = MIME_decrypt_message(session, incoming.c_str(), incoming.size(), &dec_msg, &keylist_used, &rating, &flags, &mod_src);
    1.25  
    1.26 +    TEST_ASSERT_MSG(status == PEP_STATUS_OK, tl_status_string(status));
    1.27      // generate message
    1.28      
    1.29 +    message* msg = new_message(PEP_dir_outgoing);
    1.30 +    
    1.31 +    msg->from = alice;
    1.32 +    msg->to = new_identity_list(new_identity("pep-test-carol@pep-project.org", NULL, NULL, NULL));
    1.33 +    msg->shortmsg = strdup("Boom shaka laka");
    1.34 +    msg->longmsg = strdup("Don't you get sick of these?");
    1.35 +    
    1.36 +    message* enc_msg = NULL;
    1.37 +
    1.38 +    status = encrypt_message(session, msg, NULL, &enc_msg, PEP_enc_PGP_MIME, 0);
    1.39 +    TEST_ASSERT(status == PEP_STATUS_OK);
    1.40 +    
    1.41      // ensure sent message is in 1.0 format
    1.42 -
    1.43 +    unsigned int major = 1;
    1.44 +    unsigned int minor = 0;
    1.45 +    TEST_ASSERT_MSG(verify_message_version_produced(enc_msg, &major, &minor),
    1.46 +                                                    (to_string(major) + "." + to_string(minor)).c_str());
    1.47 +    
    1.48 +    free_message(msg);
    1.49 +    free_message(enc_msg);
    1.50 +    free(dec_msg);
    1.51 +    free(mod_src);
    1.52      TEST_ASSERT(true);
    1.53  }
    1.54