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,