test blacklist / outgoing_message_rating() sync
authorVolker Birk <vb@pep.foundation>
Thu, 11 Oct 2018 13:19:22 +0200
branchsync
changeset 3042cb5f579ccc32
parent 3041 75f2a8fb579e
child 3047 bf4e1dda6c50
test blacklist / outgoing_message_rating()
test/src/engine_tests/BlacklistTests.cc
     1.1 --- a/test/src/engine_tests/BlacklistTests.cc	Thu Oct 11 13:16:24 2018 +0200
     1.2 +++ b/test/src/engine_tests/BlacklistTests.cc	Thu Oct 11 13:19:22 2018 +0200
     1.3 @@ -143,6 +143,25 @@
     1.4               << "Expected it to be empty or (possibly) " << bl_fpr_2 << endl;
     1.5      TEST_ASSERT_MSG((!(blacklisted_identity->fpr) || blacklisted_identity->fpr[0] == '\0'|| (strcmp(blacklisted_identity->fpr, bl_fpr_2) == 0)), "!(blacklisted_identity->fpr) || blacklisted_identity->fpr[0] == '\0'|| (strcmp(blacklisted_identity->fpr, bl_fpr_2) == 0)");
     1.6  
     1.7 +    pEp_identity *me = new_identity("alice@peptest.ch", NULL, "423", "Alice Miller");
     1.8 +    assert(me);
     1.9 +    PEP_STATUS status24 = myself(session, me);
    1.10 +    TEST_ASSERT_MSG((status24 == PEP_STATUS_OK), "myself: status24 == PEP_STATUS_OK");
    1.11 +
    1.12 +    message *msg23 = new_message(PEP_dir_outgoing);
    1.13 +    assert(msg23);
    1.14 +    msg23->from = me;
    1.15 +    msg23->to = new_identity_list(identity_dup(blacklisted_identity));
    1.16 +    assert(msg23->to && msg23->to->ident);
    1.17 +    PEP_rating rating23;
    1.18 +
    1.19 +    cout << "testing outgoing_message_rating() with blacklisted key in to\n";
    1.20 +    PEP_STATUS status23 = outgoing_message_rating(session, msg23, &rating23);
    1.21 +    TEST_ASSERT_MSG((status23 == PEP_STATUS_OK), "outgoing_message_rating: status must be PEP_STATUS_OK");
    1.22 +    TEST_ASSERT_MSG((rating23 == PEP_rating_unencrypted), "outgoing_message_rating: rating must be PEP_rating_unencrypted");
    1.23 +
    1.24 +    free_message(msg23);
    1.25 +
    1.26      const string keytext2 = slurp("blacklisted_pub2.asc");
    1.27      PEP_STATUS status14 = import_key(session, keytext2.c_str(), keytext2.length(), NULL);
    1.28