Skip to content

Commit

Permalink
correct enable_2fa/disable_2fa based on the server-side logic
Browse files Browse the repository at this point in the history
  • Loading branch information
ViktorYastrebov committed Nov 5, 2021
1 parent 64657d4 commit a39baad
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions tests/test_wallet.py
Original file line number Diff line number Diff line change
Expand Up @@ -349,19 +349,24 @@ async def test_is_signing_key_set(self):
assert await self.wallet.is_signing_key_set()

async def test_toggle_2fa(self):
"""
Relate to the server-side code it must be Owned type if enable_2fa is passed
let new_type = if toggle_2fa.enable {
EthAccountType::Owned
} else {
EthAccountType::No2FA
};
"""
result = await self.wallet.enable_2fa()
self.assertTrue(result)
await asyncio.sleep(20)
account_state = await self.wallet.get_account_state()
self.assertEqual(AccountTypes.NO_2FA, account_state.account_type)
self.assertEqual(AccountTypes.OWNED, account_state.account_type)

pub_key_hash = self.wallet.zk_signer.pubkey_hash_str()
result = await self.wallet.disable_2fa(pub_key_hash)
self.assertTrue(result)
account_state = await self.wallet.get_account_state()
print(f"updated account state: {account_state.account_type}")
# result = await self.wallet.disable_2fa_with_pub_key()
# self.assertTrue(result)
self.assertEqual(AccountTypes.NO_2FA, account_state.account_type)


class TestEthereumProvider(IsolatedAsyncioTestCase):
Expand Down

0 comments on commit a39baad

Please sign in to comment.