mirror of
https://github.com/chatmail/core.git
synced 2026-05-08 17:36:29 +03:00
test(deltachat-rpc-client): test Account.{import,export}_self_keys
This commit is contained in:
@@ -341,7 +341,7 @@ def test_wait_next_messages(acfactory) -> None:
|
|||||||
assert snapshot.text == "Hello!"
|
assert snapshot.text == "Hello!"
|
||||||
|
|
||||||
|
|
||||||
def test_import_export(acfactory, tmp_path) -> None:
|
def test_import_export_backup(acfactory, tmp_path) -> None:
|
||||||
alice = acfactory.new_configured_account()
|
alice = acfactory.new_configured_account()
|
||||||
alice.export_backup(tmp_path)
|
alice.export_backup(tmp_path)
|
||||||
|
|
||||||
@@ -352,6 +352,31 @@ def test_import_export(acfactory, tmp_path) -> None:
|
|||||||
assert alice2.manager.get_system_info()
|
assert alice2.manager.get_system_info()
|
||||||
|
|
||||||
|
|
||||||
|
def test_import_export_keys(acfactory, tmp_path) -> None:
|
||||||
|
alice, bob = acfactory.get_online_accounts(2)
|
||||||
|
|
||||||
|
bob_addr = bob.get_config("addr")
|
||||||
|
alice_contact_bob = alice.create_contact(bob_addr, "Bob")
|
||||||
|
alice_chat_bob = alice_contact_bob.create_chat()
|
||||||
|
alice_chat_bob.send_text("Hello Bob!")
|
||||||
|
|
||||||
|
snapshot = bob.get_message_by_id(bob.wait_for_incoming_msg_event().msg_id).get_snapshot()
|
||||||
|
assert snapshot.text == "Hello Bob!"
|
||||||
|
|
||||||
|
# Alice resetups account, but keeps the key.
|
||||||
|
alice_keys_path = tmp_path / "alice_keys"
|
||||||
|
alice_keys_path.mkdir()
|
||||||
|
alice.export_self_keys(alice_keys_path)
|
||||||
|
alice = acfactory.resetup_account(alice)
|
||||||
|
alice.import_self_keys(alice_keys_path)
|
||||||
|
|
||||||
|
snapshot.chat.accept()
|
||||||
|
snapshot.chat.send_text("Hello Alice!")
|
||||||
|
snapshot = alice.get_message_by_id(alice.wait_for_incoming_msg_event().msg_id).get_snapshot()
|
||||||
|
assert snapshot.text == "Hello Alice!"
|
||||||
|
assert snapshot.show_padlock
|
||||||
|
|
||||||
|
|
||||||
def test_openrpc_command_line() -> None:
|
def test_openrpc_command_line() -> None:
|
||||||
"""Test that "deltachat-rpc-server --openrpc" command returns an OpenRPC specification."""
|
"""Test that "deltachat-rpc-server --openrpc" command returns an OpenRPC specification."""
|
||||||
out = subprocess.run(["deltachat-rpc-server", "--openrpc"], capture_output=True, check=True).stdout
|
out = subprocess.run(["deltachat-rpc-server", "--openrpc"], capture_output=True, check=True).stdout
|
||||||
|
|||||||
Reference in New Issue
Block a user