From d6635db93ae9232db2d39d9a8a2a3e41f65e6bf8 Mon Sep 17 00:00:00 2001 From: "Jonathan \"Duke\" Leto" Date: Fri, 24 Aug 2018 18:34:19 +0200 Subject: [PATCH] Test for new behavior for faucets --- qa/rpc-tests/cryptoconditions.py | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/qa/rpc-tests/cryptoconditions.py b/qa/rpc-tests/cryptoconditions.py index f02844001..f133ae28a 100755 --- a/qa/rpc-tests/cryptoconditions.py +++ b/qa/rpc-tests/cryptoconditions.py @@ -7,7 +7,7 @@ from test_framework.test_framework import BitcoinTestFramework from test_framework.authproxy import JSONRPCException from test_framework.util import assert_equal, assert_greater_than, \ initialize_chain_clean, initialize_chain, start_nodes, start_node, connect_nodes_bi, \ - stop_nodes, sync_blocks, sync_mempools, wait_bitcoinds, rpc_port + stop_nodes, sync_blocks, sync_mempools, wait_bitcoinds, rpc_port, assert_raises import time from decimal import Decimal @@ -117,17 +117,14 @@ class CryptoConditionsTest (BitcoinTestFramework): assert_success(result) assert result['hex'], "hex key found" - # broadcast the xtn - result = rpc.sendrawtransaction(result['hex']) - txid = result[0] - assert txid, "found txid" + # try to broadcast the xtn, but we will get 'faucet is only for brand new addresses' + assert_raises(JSONRPCException, rpc.sendrawtransaction, [ result['hex'] ]) - # confirm above tx - rpc.generate(1) - result = rpc.getwalletinfo() - - # we should have slightly more funds from the faucet now - assert_greater_than(result['balance'], balance2) + newaddr = rpc.getnewaddress() + assert newaddr, "got a new address" + result = rpc.validateaddress(newaddr) + newpubkey = result['pubkey'] + assert newpubkey, "got a pubkey for new address" def run_dice_tests(self): rpc = self.nodes[0]