Changed test based on invalid assumption and hidden test flaw exposed by sequoia being SUPERFAST ;) sync
authorKrista 'DarthMama' Bennett <krista@pep.foundation>
Wed, 27 Mar 2019 10:02:28 +0100
branchsync
changeset 34019d9142a1490e
parent 3400 127abd38d1c2
child 3403 61dbe005c428
Changed test based on invalid assumption and hidden test flaw exposed by sequoia being SUPERFAST ;)
test/src/engine_tests/NewUpdateIdAndMyselfTests.cc
     1.1 --- a/test/src/engine_tests/NewUpdateIdAndMyselfTests.cc	Tue Mar 26 19:14:46 2019 +0100
     1.2 +++ b/test/src/engine_tests/NewUpdateIdAndMyselfTests.cc	Wed Mar 27 10:02:28 2019 +0100
     1.3 @@ -511,8 +511,7 @@
     1.4  void NewUpdateIdAndMyselfTests::key_elect_only_revoked_mistrusted() {
     1.5      // Create id with no key
     1.6      cout << "Creating new id with no key for : ";
     1.7 -    char *uniqname_10000 = strdup("AAAAtestuser@testdomain.org");
     1.8 -    srandom(time(NULL));
     1.9 +    char *uniqname_10000 = strdup("AAAAtestfool@testdomain.org");
    1.10      for(int i=0; i < 4;i++)
    1.11          uniqname_10000[i] += random() & 0xf;
    1.12      
    1.13 @@ -592,11 +591,17 @@
    1.14      status = update_identity(session, revokemaster_3000);
    1.15      TEST_ASSERT_MSG((status == PEP_STATUS_OK), tl_status_string(status));
    1.16      TEST_ASSERT_MSG((revokemaster_3000->fpr), revokemaster_3000->fpr);
    1.17 -    TEST_ASSERT_MSG((strcmp(revokemaster_3000->fpr, revoke_fpr_arr[0]) == 0
    1.18 -                    || (strcmp(revokemaster_3000->fpr, revoke_fpr_arr[0]) == 0)), 
    1.19 -                    (string("Expected ") + revoke_fpr_arr[0] + " or " + revoke_fpr_arr[1] + ", Got " + revokemaster_3000->fpr).c_str());
    1.20 -    TEST_ASSERT_MSG((revokemaster_3000->comm_type & PEP_ct_confirmed), tl_ct_string(revokemaster_3000->comm_type));    
    1.21 -    
    1.22 +    bool was_key_0 = (strcmp(revokemaster_3000->fpr, revoke_fpr_arr[0]) == 0); 
    1.23 +    bool was_key_1 = (strcmp(revokemaster_3000->fpr, revoke_fpr_arr[1]) == 0); 
    1.24 +    TEST_ASSERT_MSG(was_key_0 || was_key_1,    
    1.25 +                    (string("Expected ") + revoke_fpr_arr[0] + " or " + revoke_fpr_arr[1] + ", Got " + revokemaster_3000->fpr).c_str());                
    1.26 +    if (was_key_0) {               
    1.27 +        TEST_ASSERT_MSG((revokemaster_3000->comm_type & PEP_ct_confirmed), tl_ct_string(revokemaster_3000->comm_type));    
    1.28 +    }    
    1.29 +    else {   
    1.30 +        TEST_ASSERT_MSG((revokemaster_3000->comm_type & PEP_ct_OpenPGP_unconfirmed), tl_ct_string(revokemaster_3000->comm_type));
    1.31 +    }
    1.32 +                
    1.33      cout << "Success! So let's mistrust " << revoke_fpr_arr[0] << ", because seriously, that key was so uncool." << endl;
    1.34      
    1.35      free(revokemaster_3000->fpr);