def test_update_password(self): keystore = Imported_KeyStore() keystore._keypairs = { PublicKey.from_hex(a): b for a, b in keypairs_dict.items() } keystore.update_password('new password', 'password') pubkey = list(keystore._keypairs.keys())[0] assert keystore.export_private_key(pubkey, 'new password') == ( 'KwdMAjGmerYanjeui5SHS7JkmpZvVipYvB2LJGU1ZxJwYvP98617') with pytest.raises(AssertionError): keystore.update_password('', 'new password')
def test_update_password(self): keystore = Imported_KeyStore({'keypairs': keypairs_dict}) keystore.update_password('password', 'new password') pubkey = list(keystore.keypairs.keys())[0] assert keystore.export_private_key(pubkey, 'new password') == ( 'KwdMAjGmerYanjeui5SHS7JkmpZvVipYvB2LJGU1ZxJwYvP98617') keystore.update_password('new password', '') assert keystore.export_private_key(pubkey, None) == ( 'KwdMAjGmerYanjeui5SHS7JkmpZvVipYvB2LJGU1ZxJwYvP98617') with pytest.raises(InvalidPassword): keystore.export_private_key(pubkey, '')