refactor(deltachat-rpc-client): factor out resetup_account()

This commit is contained in:
link2xt
2023-10-31 19:48:52 +00:00
parent 9b9108320e
commit 045d919cdc
2 changed files with 11 additions and 8 deletions

View File

@@ -59,6 +59,16 @@ class ACFactory:
def get_online_accounts(self, num: int) -> List[Account]:
return [self.get_online_account() for _ in range(num)]
def resetup_account(self, ac: Account) -> Account:
"""Resetup account from scratch, losing the encryption key."""
ac.stop_io()
ac_clone = self.get_unconfigured_account()
for i in ["addr", "mail_pw"]:
ac_clone.set_config(i, ac.get_config(i))
ac.remove()
ac_clone.configure()
return ac_clone
def send_message(
self,
to_account: Account,

View File

@@ -419,14 +419,7 @@ def test_verified_group_recovery(acfactory, rpc) -> None:
break
logging.info("ac2 logs in on a new device")
ac2.stop_io()
ac2_clone = acfactory.get_unconfigured_account()
for i in ["addr", "mail_pw"]:
ac2_clone.set_config(i, ac2.get_config(i))
rpc.remove_account(ac2.id)
ac2_clone.configure()
ac2 = ac2_clone
del ac2_clone
ac2 = acfactory.resetup_account(ac2)
logging.info("ac2 reverifies with ac3")
qr_code, _svg = ac3.get_qr_code()