def test_api_get_transaction_by_hash_bad_request(): tx_hash = 'th_LUKG' try: EPOCH_CLI.get_transaction_by_hash(hash=tx_hash) assert False except openapi.OpenAPIClientException as e: assert e.code == 400
def test_api_get_transaction_by_hash_not_found(): tx_hash = 'th_LUKGEWyZSwyND7vcQwZwLgUXi23WJLQb9jKgJTr1it9QFViMC' try: EPOCH_CLI.get_transaction_by_hash(hash=tx_hash) assert False except openapi.OpenAPIClientException as e: assert e.code == 404
def test_signing_create_transaction(): # generate a new account new_account = Account.generate() receiver_address = new_account.get_address() # create a spend transaction txb = TxBuilder(EPOCH_CLI, ACCOUNT) tx, sg, tx_hash = txb.tx_spend(receiver_address, 321, "test test ", TEST_FEE, TEST_TTL) # this call will fail if the hashes of the transaction do not match txb.post_transaction(tx, tx_hash) # make sure this works for very short block times spend_tx = EPOCH_CLI.get_transaction_by_hash(hash=tx_hash) assert spend_tx.signatures[0] == sg