def add_account(self, *args): # Registration Account.enable_unaudited_hdwallet_features() acct, mnemonic = Account.create_with_mnemonic() # Get private key private_class = Account.from_mnemonic(mnemonic) private_dict = private_class.__dict__ private_key = str(private_dict['_key_obj']) CteaPerceApp.mnemonic = mnemonic CteaPerceApp.public = acct.address CteaPerceApp.private_key = private_key
def test_unknown_language(): with pytest.raises(ValidationError, match="Invalid language choice.*"): Account.create_with_mnemonic(language="pig latin")
def test_bad_account_path2(): with pytest.raises(ValidationError, match="Path.*is not valid.*"): Account.create_with_mnemonic(account_path='m/not/an/account/path')
def test_incorrect_num_words(): with pytest.raises(ValidationError, match="Invalid choice for number of words.*"): Account.create_with_mnemonic(num_words=11)
def test_bad_passphrase(): a1, mnemonic = Account.create_with_mnemonic(passphrase="My passphrase") a2 = Account.from_mnemonic(mnemonic, passphrase="Not my passphrase") assert a1.address != a2.address
def test_account_restore(): a1, mnemonic = Account.create_with_mnemonic(num_words=24, passphrase="TESTING") a2 = Account.from_mnemonic(mnemonic, passphrase="TESTING") assert a1.address == a2.address
def createWithMnemonic(): acct, mnemonic = Account.create_with_mnemonic() return acct, mnemonic