test/src/engine_tests/KeyResetMessageTests.cc
branchsync_test_refactor
changeset 3314 18a40b81649a
parent 3296 fe7cbfc8e84f
child 3335 09af2cf0ac74
     1.1 --- a/test/src/engine_tests/KeyResetMessageTests.cc	Sun Feb 24 22:41:22 2019 +0100
     1.2 +++ b/test/src/engine_tests/KeyResetMessageTests.cc	Mon Feb 25 12:28:51 2019 +0100
     1.3 @@ -48,21 +48,21 @@
     1.4      fake_this = this;                                                                  
     1.5  }
     1.6  
     1.7 -PEP_STATUS KeyResetMessageTests::message_send_callback(message* msg) {
     1.8 -    fake_this->m_queue.push_back(msg);
     1.9 -    return PEP_STATUS_OK;    
    1.10 -}
    1.11 +// PEP_STATUS KeyResetMessageTests::message_send_callback(message* msg) {
    1.12 +//     fake_this->device->send_queue.push_back(msg);
    1.13 +//     return PEP_STATUS_OK;    
    1.14 +// }
    1.15  
    1.16  void KeyResetMessageTests::setup() {
    1.17      EngineTestIndividualSuite::setup();
    1.18 -    m_queue.clear();
    1.19 -    device->device_messageToSend = &KeyResetMessageTests::message_send_callback;
    1.20 -    session->messageToSend = device->device_messageToSend;
    1.21 +//    device->send_queue.clear();
    1.22 +//    device->message_to_send = &KeyResetMessageTests::message_send_callback;
    1.23 +//    session->messageToSend = device->message_to_send;
    1.24  }
    1.25  
    1.26  void KeyResetMessageTests::tear_down() {
    1.27 -    device->device_messageToSend = NULL;
    1.28 -    session->messageToSend = NULL;
    1.29 +//    device->device_messageToSend = NULL;
    1.30 +//    session->messageToSend = NULL;
    1.31      EngineTestIndividualSuite::tear_down();
    1.32  }
    1.33  
    1.34 @@ -176,8 +176,9 @@
    1.35      outgoing_msg->to = send_idents;
    1.36      outgoing_msg->shortmsg = strdup("Well isn't THIS a useless message...");
    1.37      outgoing_msg->longmsg = strdup("Hi Mom...\n");
    1.38 -    // outgoing_msg->attachments = new_bloblist(NULL, 0, "application/octet-stream", NULL);
    1.39 -    // that's illegal - VB.
    1.40 +    outgoing_msg->attachments = new_bloblist(NULL, 0, "application/octet-stream", NULL);
    1.41 +    // that's illegal - VB. 
    1.42 +    // I got this from your tests, and IIRC, there was some reason you guys always put it in there. - KB
    1.43      cout << "Message created.\n\n";
    1.44      cout << "Encrypting message as MIME multipart…\n";
    1.45      message* enc_outgoing_msg = nullptr;
    1.46 @@ -210,7 +211,7 @@
    1.47      
    1.48      status = key_reset(session, alice_fpr, from_ident);
    1.49      TEST_ASSERT_MSG((status == PEP_STATUS_OK), tl_status_string(status));
    1.50 -    TEST_ASSERT(m_queue.size() > 0);
    1.51 +    TEST_ASSERT(device->send_queue.size() > 0);
    1.52      status = myself(session, from_ident);
    1.53      string new_fpr = from_ident->fpr;
    1.54      TEST_ASSERT_MSG((strcmp(alice_fpr, new_fpr.c_str()) != 0), new_fpr.c_str());
    1.55 @@ -224,9 +225,9 @@
    1.56      hashmap[fenris_user_id] = false;
    1.57      
    1.58      // Number of messages we SHOULD be sending.
    1.59 -    TEST_ASSERT(m_queue.size() == 4);
    1.60 +    TEST_ASSERT(device->send_queue.size() == 4);
    1.61      
    1.62 -    for (vector<message*>::iterator it = m_queue.begin(); it != m_queue.end(); it++) {
    1.63 +    for (vector<message*>::iterator it = device->send_queue.begin(); it != device->send_queue.end(); it++) {
    1.64          message* curr_sent_msg = *it;
    1.65          TEST_ASSERT(curr_sent_msg);
    1.66          TEST_ASSERT(curr_sent_msg->to);
    1.67 @@ -256,7 +257,7 @@
    1.68      }
    1.69      
    1.70      // MESSAGE LIST NOW INVALID.
    1.71 -    m_queue.clear();
    1.72 +    device->send_queue.clear();
    1.73      
    1.74      // Make sure we have messages only to desired recips
    1.75      TEST_ASSERT(hashmap[alice_user_id] == false);
    1.76 @@ -423,7 +424,7 @@
    1.77  
    1.78      status = key_reset(session, alice_fpr, from_ident);
    1.79      TEST_ASSERT_MSG((status == PEP_STATUS_OK), tl_status_string(status));
    1.80 -    m_queue.clear();
    1.81 +    device->send_queue.clear();
    1.82      
    1.83      string received_mail = slurp("test_files/398_gabrielle_to_alice.eml");
    1.84      char* decrypted_msg = NULL;
    1.85 @@ -433,7 +434,7 @@
    1.86      PEP_decrypt_flags_t flags;
    1.87      status = MIME_decrypt_message(session, received_mail.c_str(), received_mail.size(),
    1.88                                    &decrypted_msg, &keylist, &rating, &flags, &modified_src);
    1.89 -    TEST_ASSERT(m_queue.size() == 0);
    1.90 +    TEST_ASSERT(device->send_queue.size() == 0);
    1.91      free(decrypted_msg);
    1.92      free(modified_src);
    1.93      free_stringlist(keylist);
    1.94 @@ -487,8 +488,8 @@
    1.95  
    1.96      status = key_reset(session, alice_fpr, from_ident);
    1.97      TEST_ASSERT_MSG((status == PEP_STATUS_OK), tl_status_string(status));
    1.98 -    TEST_ASSERT(m_queue.size() == 0);
    1.99 -    m_queue.clear();
   1.100 +    TEST_ASSERT(device->send_queue.size() == 0);
   1.101 +    device->send_queue.clear();
   1.102  
   1.103      // Now we get mail from Gabi, who only has our old key AND has become
   1.104      // a pEp user in the meantime...
   1.105 @@ -501,8 +502,8 @@
   1.106      status = MIME_decrypt_message(session, received_mail.c_str(), received_mail.size(),
   1.107                                    &decrypted_msg, &keylist, &rating, &flags, &modified_src);
   1.108      
   1.109 -    TEST_ASSERT(m_queue.size() == 1);
   1.110 -    vector<message*>::iterator it = m_queue.begin();
   1.111 +    TEST_ASSERT(device->send_queue.size() == 1);
   1.112 +    vector<message*>::iterator it = device->send_queue.begin();
   1.113      message* reset_msg = *it;
   1.114      TEST_ASSERT(reset_msg);    
   1.115      TEST_ASSERT(reset_msg->from);