@@ -341,7 +341,7 @@ def test_wait_next_messages(acfactory) -> None:
341
341
assert snapshot .text == "Hello!"
342
342
343
343
344
- def test_import_export (acfactory , tmp_path ) -> None :
344
+ def test_import_export_backup (acfactory , tmp_path ) -> None :
345
345
alice = acfactory .new_configured_account ()
346
346
alice .export_backup (tmp_path )
347
347
@@ -352,6 +352,31 @@ def test_import_export(acfactory, tmp_path) -> None:
352
352
assert alice2 .manager .get_system_info ()
353
353
354
354
355
+ def test_import_export_keys (acfactory , tmp_path ) -> None :
356
+ alice , bob = acfactory .get_online_accounts (2 )
357
+
358
+ bob_addr = bob .get_config ("addr" )
359
+ alice_contact_bob = alice .create_contact (bob_addr , "Bob" )
360
+ alice_chat_bob = alice_contact_bob .create_chat ()
361
+ alice_chat_bob .send_text ("Hello Bob!" )
362
+
363
+ snapshot = bob .get_message_by_id (bob .wait_for_incoming_msg_event ().msg_id ).get_snapshot ()
364
+ assert snapshot .text == "Hello Bob!"
365
+
366
+ # Alice resetups account, but keeps the key.
367
+ alice_keys_path = tmp_path / "alice_keys"
368
+ alice_keys_path .mkdir ()
369
+ alice .export_self_keys (alice_keys_path )
370
+ alice = acfactory .resetup_account (alice )
371
+ alice .import_self_keys (alice_keys_path )
372
+
373
+ snapshot .chat .accept ()
374
+ snapshot .chat .send_text ("Hello Alice!" )
375
+ snapshot = alice .get_message_by_id (alice .wait_for_incoming_msg_event ().msg_id ).get_snapshot ()
376
+ assert snapshot .text == "Hello Alice!"
377
+ assert snapshot .show_padlock
378
+
379
+
355
380
def test_openrpc_command_line () -> None :
356
381
"""Test that "deltachat-rpc-server --openrpc" command returns an OpenRPC specification."""
357
382
out = subprocess .run (["deltachat-rpc-server" , "--openrpc" ], capture_output = True , check = True ).stdout
0 commit comments