@ -29,8 +29,8 @@ vector<::sync_handshake_signal> expected_notification = { SYNC_NOTIFY_IN_GROUP,
: : PEP_STATUS test_messageToSend ( : : message * _msg )
{
static auto actual = expected_msg . begin ( ) ;
static auto actual = expected_msg . begin ( ) ;
Test : : Message msg = Test : : make_message ( _msg ) ;
string text = Test : : make_pEp_msg ( msg ) ;
cerr < < " expecting: " < < * actual < < endl ;
@ -54,35 +54,38 @@ vector<::sync_handshake_signal> expected_notification = { SYNC_NOTIFY_IN_GROUP,
int main ( int argc , char * * argv )
{
pEp : : Adapter : : pEpLog : : set_enabled ( true ) ;
Test : : setup ( argc , argv ) ;
Adapter : : session . initialize ( pEp : : Adapter : : SyncModes : : Async , false ) ;
pEpLog ( getenv ( " HOME " ) ) ;
int n ;
std : : cin > > n ;
Adapter : : session . initialize ( Adapter : : SyncModes : : Async , false ) ;
// set up two own identites for sync
passphrase_cache . add ( " erwin " ) ;
passphrase_cache . add ( " bob " ) ;
const char * bob_filename = ENGINE_TES T
" /test_keys/ bob-primary-with-password-bob-subkey-without.pgp" ;
const char * bob_fpr = " 5C76378A62B04CF3F41BEC8D4940FC9FA1878736 " ;
std : : string bob_filename = Test : : get_resource_abs (
" bob-primary-with-password-bob-subkey-without.pgp " ) ;
std : : string bob_fpr = " 5C76378A62B04CF3F41BEC8D4940FC9FA1878736 " ;
const char * erwin_filename = ENGINE_TEST " /test_keys/ erwin_normal_encrypted.pgp" ;
const char * erwin_fpr = " CBA968BC01FCEB89F04CCF155C5E9E3F0420A570 " ;
std : : string erwin_filename = Test : : get_resource_abs ( " erwin_normal_encrypted.pgp " ) ;
std : : string erwin_fpr = " CBA968BC01FCEB89F04CCF155C5E9E3F0420A570 " ;
Test : : import_key_from_file ( bob_filename ) ;
Test : : import_key_from_file ( erwin_filename ) ;
Test : : Identity bob = Test : : make_identity (
: : new_identity ( " bob@example.org " , bob_fpr , " BOB " , " Bob Dog " ) ) ;
PEP_STATUS status = : : set_own_key ( Adapter : : session ( ) , bob . get ( ) , bob_fpr ) ;
: : new_identity ( " bob@example.org " , bob_fpr . c_str ( ) , " BOB " , " Bob Dog " ) ) ;
PEP_STATUS status = : : set_own_key ( Adapter : : session ( ) , bob . get ( ) , bob_fpr . c_str ( ) ) ;
assert ( status = = PEP_STATUS_OK ) ;
status = : : enable_identity_for_sync ( Adapter : : session ( ) , bob . get ( ) ) ;
assert ( status = = PEP_STATUS_OK ) ;
Test : : Identity erwin = Test : : make_identity (
: : new_identity ( " erwin@example.org " , erwin_fpr , " BOB " , " Bob is Erwin " ) ) ;
status = : : set_own_key ( Adapter : : session ( ) , erwin . get ( ) , erwin_fpr ) ;
: : new_identity ( " erwin@example.org " , erwin_fpr . c_str ( ) , " BOB " , " Bob is Erwin " ) ) ;
status = : : set_own_key ( Adapter : : session ( ) , erwin . get ( ) , erwin_fpr . c_str ( ) ) ;
assert ( status = = PEP_STATUS_OK ) ;
status = : : enable_identity_for_sync ( Adapter : : session ( ) , erwin . get ( ) ) ;
@ -99,10 +102,8 @@ int main(int argc, char** argv)
Adapter : : start_sync ( ) ;
// leave device group
status = : : leave_device_group ( Adapter : : session ( ) ) ;
throw_status ( status ) ;
// wait for sync shutdown and release first session
Test : : join_sync_thread ( ) ;