Esempio n. 1
0
def test_name_revocation():
    domain = random_domain()
    name = EPOCH_CLI.AEName(domain)
    name.full_claim_blocking(ACCOUNT)
    name.revoke(ACCOUNT)
    assert name.status == AEName.Status.REVOKED
    assert EPOCH_CLI.AEName(domain).is_available()
Esempio n. 2
0
def test_cli_name_claim(account_path):
    # create a random domain
    domain = random_domain()
    print(f"Domain is {domain}")
    # call the cli
    call_aecli('name', 'claim', account_path, domain, '--password', 'aeternity_bc')
    EPOCH_CLI.AEName(domain).status == AEName.Status.CLAIMED
Esempio n. 3
0
def test_name_status_unavailable():
    # claim a domain
    domain = random_domain()
    print(f"domain is {domain}")
    occupy_name = EPOCH_CLI.AEName(domain)
    occupy_name.full_claim_blocking(ACCOUNT)
    # try to get the same name
    same_name = EPOCH_CLI.AEName(domain)
    assert not same_name.is_available()
Esempio n. 4
0
def test_name_claim_lifecycle():
    try:
        domain = random_domain()
        name = EPOCH_CLI.AEName(domain)
        assert name.status == AEName.Status.UNKNOWN
        name.update_status()
        assert name.status == AEName.Status.AVAILABLE
        name.preclaim(ACCOUNT)
        assert name.status == AEName.Status.PRECLAIMED
        name.claim(ACCOUNT)
        assert name.status == AEName.Status.CLAIMED
    except Exception as e:
        print(e)
        assert e is None
Esempio n. 5
0
def test_name_update():
    # claim a domain
    domain = random_domain()
    print(f"domain is {domain}")
    name = EPOCH_CLI.AEName(domain)
    print("Claim name ", domain)
    name.full_claim_blocking(ACCOUNT)
    # domain claimed
    name.update_status()
    assert not EPOCH_CLI.AEName(domain).is_available(), 'The name should be claimed now'
    name.update_status()
    print("claimed name", name)
    print("pointers", name.pointers)
    assert len(name.pointers) > 0, 'Pointers should not be empty'
    assert name.pointers[0]['id'] == ACCOUNT.get_address()
    assert name.pointers[0]['key'] == "account_pubkey"
Esempio n. 6
0
def test_name_transfer_ownership():
    name = EPOCH_CLI.AEName(random_domain())
    name.full_claim_blocking(ACCOUNT)
    assert name.status == AEName.Status.CLAIMED
    name.update_status()
    assert name.pointers[0]['id'] == ACCOUNT.get_address()
    assert name.pointers[0]['key'] == "account_pubkey"

    new_key_pair = Account.generate()
    # put some coins into the account so the account is in the state tree
    # otherwise it couldn't become the owner of an address.
    EPOCH_CLI.spend(ACCOUNT, new_key_pair.get_address(), 100)
    # now transfer the name to the other account
    name.transfer_ownership(ACCOUNT, new_key_pair.get_address())
    assert name.status == AEName.Status.TRANSFERRED
    # try changing the target using that new account
    name.update_status()
    name.update(new_key_pair, new_key_pair.get_address())
    name.update_status()
    assert len(name.pointers) > 0, 'Pointers should not be empty'
    assert name.pointers[0]['id'] == new_key_pair.get_address()
    assert name.pointers[0]['key'] == "account_pubkey"
Esempio n. 7
0
def test_name_status_availavle():
    name = EPOCH_CLI.AEName(random_domain())
    assert name.status == AEName.Status.UNKNOWN
    name.update_status()
    assert name.status == AEName.Status.AVAILABLE
Esempio n. 8
0
def test_name_is_available():
    name = EPOCH_CLI.AEName(random_domain())
    assert name.is_available()
Esempio n. 9
0
def test_name_committment():
    domain = random_domain()
    name = EPOCH_CLI.AEName(domain)
    cl = name._get_commitment_hash()
    cr = name.client.get_commitment_id(name=name.domain, salt=name.preclaim_salt)
    assert cl == cr.commitment_id