Skip to content

Commit

Permalink
test: add -getinfo command parsing regression tests
Browse files Browse the repository at this point in the history
These tests fail without the changes in the first commit of this PR.

Github-Pull: bitcoin#19089
Rebased-From: 1989439
  • Loading branch information
jonatack authored and luke-jr committed Jun 13, 2020
1 parent 2be8ee8 commit 4012891
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions test/functional/interface_bitcoin_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,22 @@ def run_test(self):
self.log.info("Make sure that -getinfo with arguments fails")
assert_raises_process_error(1, "-getinfo takes no arguments", self.nodes[0].cli('-getinfo').help)

self.log.info("Test -getinfo command parsing")

self.log.debug("Test -getinfo=1 and -getinfo=-1 both succeed")
for cmd in ['-getinfo=1', '-getinfo=-1']:
assert_equal(rpc_response['blocks'], self.nodes[0].cli(cmd).send_cli()['blocks'])

self.log.debug("Test -getinfo=0 and -nogetinfo both raise 'too few parameters'")
err_msg = "error: too few parameters (need at least command)"
for cmd in ['-getinfo=0', '-nogetinfo']:
assert_raises_process_error(1, err_msg, self.nodes[0].cli(cmd).send_cli)

self.log.debug("Test -igetinfo and -getinfos both raise 'Invalid parameter'")
err_msg = "Error parsing command line arguments: Invalid parameter"
for cmd in ['-igetinfo', '-getinfos']:
assert_raises_process_error(1, "{} {}".format(err_msg, cmd), self.nodes[0].cli(cmd).send_cli)

self.log.info("Test that -getinfo returns the expected network and blockchain info")
cli_get_info = self.nodes[0].cli('-getinfo').send_cli()
network_info = self.nodes[0].getnetworkinfo()
Expand Down

0 comments on commit 4012891

Please sign in to comment.