MCPcopy Create free account
hub / github.com/bitcoin/bitcoin / test_cli

Method test_cli

test/functional/interface_ipc_cli.py:27–36  ·  view source on GitHub ↗
(self, args, error=None)

Source from the content-addressed store, hash-verified

25 super().setup_nodes()
26
27 def test_cli(self, args, error=None):
28 # Intentionally set wrong RPC password so only IPC not HTTP connections work
29 args = [self.binary_paths.bitcoincli, f"-datadir={self.nodes[0].datadir_path}", "-rpcpassword=wrong"] + args + ["echo", "foo"]
30 result = subprocess.run(args, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, text=True)
31 if error is None:
32 assert_equal(result.stdout, '[\n "foo"\n]\n')
33 else:
34 assert result.stdout.startswith(error), f"Output didn't start with the expected error {error!r}:\n{result.stdout}"
35 assert_equal(result.stderr, None)
36 assert_equal(result.returncode, 0 if error is None else 1)
37
38 def run_test(self):
39 node = self.nodes[0]

Callers 1

run_testMethod · 0.95

Calls 2

assert_equalFunction · 0.90
runMethod · 0.45

Tested by

no test coverage detected