even more tests sync
authorKrista 'DarthMama' Bennett <krista@pep.foundation>
Tue, 30 Apr 2019 17:53:12 +0200
branchsync
changeset 3588e00a6dfd1fc2
parent 3587 28eaa98bc5b0
child 3589 0627024f0184
even more tests
test/src/engine_tests/OwnKeysRetrieveTests.cc
     1.1 --- a/test/src/engine_tests/OwnKeysRetrieveTests.cc	Tue Apr 30 17:47:53 2019 +0200
     1.2 +++ b/test/src/engine_tests/OwnKeysRetrieveTests.cc	Tue Apr 30 17:53:12 2019 +0200
     1.3 @@ -423,7 +423,79 @@
     1.4  }
     1.5  
     1.6  void OwnKeysRetrieveTests::check_own_keys_retrieve_no_own() {
     1.7 -    TEST_ASSERT(true);
     1.8 +    PEP_STATUS status = set_up_ident_from_scratch(session,
     1.9 +                "test_keys/pub/pep.test.alexander0-0x3B7302DB_pub.asc",
    1.10 +                "pep.test.alexander0@darthmama.org", "F4598A17D4690EB3B5B0F6A344F04E963B7302DB", 
    1.11 +                "NotMe", "Xander in Wonderland", NULL, false
    1.12 +            );
    1.13 +    TEST_ASSERT_MSG(status == PEP_STATUS_OK, tl_status_string(status));
    1.14 +
    1.15 +    pEp_identity* a_pub = new_identity("pep.test.alexander0@darthmama.org", NULL, "NotMe", NULL);
    1.16 +    status = update_identity(session, a_pub);
    1.17 +    TEST_ASSERT(status == PEP_STATUS_OK);
    1.18 +    TEST_ASSERT(strcmp(a_pub->fpr, "F4598A17D4690EB3B5B0F6A344F04E963B7302DB") == 0);
    1.19 +    status = trust_personal_key(session, a_pub);
    1.20 +    TEST_ASSERT(status == PEP_STATUS_OK);
    1.21 +    free_identity(a_pub);
    1.22 +    a_pub = NULL;
    1.23 +
    1.24 +
    1.25 +    // Own pub key
    1.26 +    TEST_ASSERT_MSG(slurp_and_import_key(session, "test_keys/pub/pep.test.alexander5-0x0773CD29_pub.asc"),
    1.27 +                    "Unable to import test_keys/pub/pep.test.alexander5-0x0773CD29_pub.asc");
    1.28 +    
    1.29 +    // Make it an own identity in the DB
    1.30 +    a_pub = new_identity("pep.test.alexander0@darthmama.org", "58BCC2BF2AE1E3C4FBEAB89AD7838ACA0773CD29", "NotMe", NULL);
    1.31 +    a_pub->comm_type = PEP_ct_pEp;
    1.32 +    status = set_trust(session, a_pub);
    1.33 +    TEST_ASSERT(status == PEP_STATUS_OK);    
    1.34 +    free_identity(a_pub);
    1.35 +    a_pub = NULL;
    1.36 +
    1.37 +    // Own pub key
    1.38 +    TEST_ASSERT_MSG(slurp_and_import_key(session, "test_keys/pub/pep.test.alexander6-0x0019697D_pub.asc"),
    1.39 +                    "Unable to import test_keys/pub/pep.test.alexander6-0x0019697D_pub.asc");
    1.40 +    
    1.41 +    // Make it an own identity in the DB
    1.42 +    a_pub = new_identity("pep.test.alexander0@darthmama.org", "74D79B4496E289BD8A71B70BA8E2C4530019697D", "NotMe", NULL);
    1.43 +    a_pub->comm_type = PEP_ct_pEp;
    1.44 +    status = set_trust(session, a_pub);
    1.45 +    TEST_ASSERT(status == PEP_STATUS_OK);    
    1.46 +    free_identity(a_pub);
    1.47 +    a_pub = NULL;
    1.48 +
    1.49 +    // Own pub key
    1.50 +    TEST_ASSERT_MSG(slurp_and_import_key(session, "test_keys/pub/pep.test.alexander6-0x503B14D8_pub.asc"),
    1.51 +                    "Unable to import test_keys/pub/pep.test.alexander6-0x503B14D8_pub.asc");
    1.52 +    
    1.53 +    // Make it an own identity in the DB
    1.54 +    a_pub = new_identity("pep.test.alexander0@darthmama.org", "2E21325D202A44BFD9C607FCF095B202503B14D8", "NotMe", NULL);
    1.55 +    a_pub->comm_type = PEP_ct_pEp;
    1.56 +    status = set_trust(session, a_pub);
    1.57 +    TEST_ASSERT(status == PEP_STATUS_OK);    
    1.58 +    free_identity(a_pub);
    1.59 +    a_pub = NULL;
    1.60 +
    1.61 +    // Own pub key
    1.62 +    TEST_ASSERT_MSG(slurp_and_import_key(session, "test_keys/pub/pep.test.alexander6-0xA216E95A_pub.asc"),
    1.63 +                    "Unable to import test_keys/pub/pep.test.alexander6-0xA216E95A_pub.asc");
    1.64 +    
    1.65 +    // Make it an own identity in the DB
    1.66 +    a_pub = new_identity("pep.test.alexander0@darthmama.org", "3C1E713D8519D7F907E3142D179EAA24A216E95A", "NotMe", NULL);
    1.67 +    a_pub->comm_type = PEP_ct_pEp;
    1.68 +    status = set_trust(session, a_pub);
    1.69 +    TEST_ASSERT(status == PEP_STATUS_OK);    
    1.70 +    free_identity(a_pub);
    1.71 +    a_pub = NULL;
    1.72 +    
    1.73 +    // Ok, see if we get anything back.
    1.74 +    stringlist_t* keylist = NULL;
    1.75 +    
    1.76 +    status = _own_keys_retrieve(session, &keylist, 0, true);
    1.77 +    TEST_ASSERT_MSG(status == PEP_STATUS_OK, tl_status_string(status));
    1.78 +    TEST_ASSERT(!keylist);
    1.79 +
    1.80 +    free_stringlist(keylist);
    1.81  }
    1.82  
    1.83  void OwnKeysRetrieveTests::check_own_keys_retrieve_multi_idents_one_key() {