Browse Source

qa: Make TestNodeCLI command optional in send_cli

0.16
MarcoFalke 7 years ago
parent
commit
fae7b14a04
  1. 2
      test/functional/bitcoin_cli.py
  2. 6
      test/functional/test_framework/test_node.py

2
test/functional/bitcoin_cli.py

@ -39,7 +39,7 @@ class TestBitcoinCli(BitcoinTestFramework):
assert_raises_process_error(1, "-getinfo takes no arguments", self.nodes[0].cli('-getinfo').help) assert_raises_process_error(1, "-getinfo takes no arguments", self.nodes[0].cli('-getinfo').help)
self.log.info("Compare responses from `bitcoin-cli -getinfo` and the RPCs data is retrieved from.") self.log.info("Compare responses from `bitcoin-cli -getinfo` and the RPCs data is retrieved from.")
cli_get_info = self.nodes[0].cli().send_cli('-getinfo') cli_get_info = self.nodes[0].cli('-getinfo').send_cli()
wallet_info = self.nodes[0].getwalletinfo() wallet_info = self.nodes[0].getwalletinfo()
network_info = self.nodes[0].getnetworkinfo() network_info = self.nodes[0].getnetworkinfo()
blockchain_info = self.nodes[0].getblockchaininfo() blockchain_info = self.nodes[0].getblockchaininfo()

6
test/functional/test_framework/test_node.py

@ -238,7 +238,7 @@ class TestNodeCLI():
results.append(dict(error=e)) results.append(dict(error=e))
return results return results
def send_cli(self, command, *args, **kwargs): def send_cli(self, command=None, *args, **kwargs):
"""Run bitcoin-cli command. Deserializes returned string as python object.""" """Run bitcoin-cli command. Deserializes returned string as python object."""
pos_args = [str(arg) for arg in args] pos_args = [str(arg) for arg in args]
@ -247,7 +247,9 @@ class TestNodeCLI():
p_args = [self.binary, "-datadir=" + self.datadir] + self.options p_args = [self.binary, "-datadir=" + self.datadir] + self.options
if named_args: if named_args:
p_args += ["-named"] p_args += ["-named"]
p_args += [command] + pos_args + named_args if command is not None:
p_args += [command]
p_args += pos_args + named_args
self.log.debug("Running bitcoin-cli command: %s" % command) self.log.debug("Running bitcoin-cli command: %s" % command)
process = subprocess.Popen(p_args, stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE, universal_newlines=True) process = subprocess.Popen(p_args, stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE, universal_newlines=True)
cli_stdout, cli_stderr = process.communicate(input=self.input) cli_stdout, cli_stderr = process.communicate(input=self.input)

Loading…
Cancel
Save