def chain_fixture(scope="module"):

    # create a new account and fill it with some money
    ACCOUNT = Account.generate()
    ACCOUNT_1 = Account.generate()  # used by for oracles
    # set the key folder as environment variables
    genesis = Account.from_public_private_key_strings(PUBLIC_KEY, PRIVATE_KEY)

    # Instantiate the node client for the tests
    NODE_CLI = NodeClient(Config(
        external_url=NODE_URL,
        internal_url=NODE_URL_DEBUG,
        network_id=NETWORK_ID,
        blocking_mode=True,
        debug=True,
    ))

    NODE_CLI.spend(genesis, ACCOUNT.get_address(), 2000000000000000000)
    a = NODE_CLI.get_account_by_pubkey(pubkey=ACCOUNT.get_address())
    print(f"Test account is {ACCOUNT.get_address()} with balance {a.balance}")

    NODE_CLI.spend(genesis, ACCOUNT_1.get_address(), 2000000000000000000)
    a = NODE_CLI.get_account_by_pubkey(pubkey=ACCOUNT_1.get_address())
    print(f"Test account (1) is {ACCOUNT_1.get_address()} with balance {a.balance}")

    return namedtupled.map({"NODE_CLI": NODE_CLI, "ACCOUNT": ACCOUNT, "ACCOUNT_1": ACCOUNT_1}, _nt_name="TestData")
Beispiel #2
0
import tempfile
from contextlib import contextmanager
import random
import string

logging.getLogger("requests").setLevel(logging.DEBUG)
logging.getLogger("urllib3").setLevel(logging.DEBUG)
logging.getLogger("aeternity").setLevel(logging.DEBUG)

PUBLIC_KEY = os.environ.get('WALLET_PUB')
PRIVATE_KEY = os.environ.get('WALLET_PRIV')
NODE_URL = os.environ.get('TEST_URL')
NODE_URL_DEBUG = os.environ.get('TEST_DEBUG_URL')
EPOCH_VERSION = '0.25.0'
# set the key folder as environment variables
genesis = Account.from_public_private_key_strings(PUBLIC_KEY, PRIVATE_KEY)
# default values for tests
TEST_FEE = 1
TEST_TTL = 50

Config.set_defaults(Config(external_url=NODE_URL, internal_url=NODE_URL_DEBUG))

# Instantiate the epoch client for the tests
EPOCH_CLI = epoch.EpochClient(blocking_mode=True, debug=True)
# create a new account and fill it with some money
ACCOUNT = Account.generate()
EPOCH_CLI.spend(genesis, ACCOUNT.get_address(), 100000)
a = EPOCH_CLI.get_account_by_pubkey(pubkey=ACCOUNT.get_address())
print(f"Test account is {ACCOUNT.get_address()} with balance {a.balance}")