diff --git a/tests/plugins/test_libplugin.c b/tests/plugins/test_libplugin.c index 6197116d8..ef62ab963 100644 --- a/tests/plugins/test_libplugin.c +++ b/tests/plugins/test_libplugin.c @@ -22,7 +22,7 @@ static struct command_result *json_helloworld(struct command *cmd, if (!name) name = name_option ? name_option : tal_strdup(tmpctx, "world"); - return command_success_str(cmd, tal_fmt(tmpctx, "hello %s", name)); + return command_success(cmd, json_out_obj(cmd, "hello", name)); } static struct command_result * diff --git a/tests/test_plugin.py b/tests/test_plugin.py index cb3f6fe4d..212eb7cce 100644 --- a/tests/test_plugin.py +++ b/tests/test_plugin.py @@ -1412,15 +1412,15 @@ def test_libplugin(node_factory): l1.rpc.check("helloworld") # Test commands - assert l1.rpc.call("helloworld") == "hello world" - assert l1.rpc.call("helloworld", {"name": "test"}) == "hello test" + assert l1.rpc.call("helloworld") == {"hello": "world"} + assert l1.rpc.call("helloworld", {"name": "test"}) == {"hello": "test"} l1.stop() l1.daemon.opts["plugin"] = plugin l1.daemon.opts["name"] = "test_opt" l1.start() - assert l1.rpc.call("helloworld") == "hello test_opt" + assert l1.rpc.call("helloworld") == {"hello": "test_opt"} # But param takes over! - assert l1.rpc.call("helloworld", {"name": "test"}) == "hello test" + assert l1.rpc.call("helloworld", {"name": "test"}) == {"hello": "test"} # Test hooks and notifications l2 = node_factory.get_node() @@ -1460,7 +1460,7 @@ def test_libplugin_deprecated(node_factory): 'name-deprecated': 'test_opt depr', 'allow-deprecated-apis': True}) - assert l1.rpc.call("helloworld") == "hello test_opt depr" + assert l1.rpc.call("helloworld") == {"hello": "test_opt depr"} l1.rpc.help('testrpc-deprecated') assert l1.rpc.call("testrpc-deprecated") == l1.rpc.getinfo()