def test_name_claim_lifecycle():
    domain = random_domain()
    name = AEName(domain)
    assert name.status == AEName.Status.UNKNOWN
    name.update_status()
    assert name.status == AEName.Status.AVAILABLE
    name.preclaim(keypair)
    assert name.status == AEName.Status.PRECLAIMED
    name.claim_blocking(keypair)
    assert name.status == AEName.Status.CLAIMED
from aeternity.aens import AEName
from aeternity.config import Config

Config.set_defaults(
    Config(external_host=3013, internal_host=3113, websocket_host=3114))

name = AEName('foobar.aet')
if name.is_available():
    name.preclaim()
    name.claim_blocking()
    name.update(target='ak$deadbeef')