From 6526cc230a80d8aa05d36c70c1d97f0e7ccf182d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Helleu?= Date: Sun, 5 May 2024 23:07:42 +0200 Subject: relay/api: add input fields in GET /api/buffers New fields returned: - "input" (string): content of input - "input_position" (integer): position in input (starts at 0) - "input_multiline" (boolean): true if the buffer allows multiline input --- tests/unit/plugins/relay/api/test-relay-api-protocol.cpp | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'tests/unit/plugins/relay') diff --git a/tests/unit/plugins/relay/api/test-relay-api-protocol.cpp b/tests/unit/plugins/relay/api/test-relay-api-protocol.cpp index 45b5fad2a..ac7eed8ed 100644 --- a/tests/unit/plugins/relay/api/test-relay-api-protocol.cpp +++ b/tests/unit/plugins/relay/api/test-relay-api-protocol.cpp @@ -432,6 +432,9 @@ TEST(RelayApiProtocolWithClient, CbBuffers) WEE_CHECK_OBJ_NUM(1, json, "number"); WEE_CHECK_OBJ_STR("formatted", json, "type"); WEE_CHECK_OBJ_STRN("WeeChat", 7, json, "title"); + WEE_CHECK_OBJ_STR("", json, "input"); + WEE_CHECK_OBJ_NUM(0, json, "input_position"); + WEE_CHECK_OBJ_BOOL(0, json, "input_multiline"); json_var = cJSON_GetObjectItem (json, "local_variables"); CHECK(json_var); CHECK(cJSON_IsObject (json_var)); @@ -439,6 +442,9 @@ TEST(RelayApiProtocolWithClient, CbBuffers) WEE_CHECK_OBJ_STR("weechat", json_var, "name"); /* get one buffer by name */ + gui_buffer_set (gui_buffers, "input", "test"); + gui_buffer_set (gui_buffers, "input_pos", "4"); + gui_buffer_set (gui_buffers, "input_multiline", "1"); test_client_recv_http ("GET /api/buffers/core.weechat", NULL, NULL); WEE_CHECK_HTTP_CODE(200, "OK"); CHECK(json_body_sent); @@ -450,11 +456,16 @@ TEST(RelayApiProtocolWithClient, CbBuffers) WEE_CHECK_OBJ_NUM(1, json, "number"); WEE_CHECK_OBJ_STR("formatted", json, "type"); WEE_CHECK_OBJ_STRN("WeeChat", 7, json, "title"); + WEE_CHECK_OBJ_STR("test", json, "input"); + WEE_CHECK_OBJ_NUM(4, json, "input_position"); + WEE_CHECK_OBJ_BOOL(1, json, "input_multiline"); json_var = cJSON_GetObjectItem (json, "local_variables"); CHECK(json_var); CHECK(cJSON_IsObject (json_var)); WEE_CHECK_OBJ_STR("core", json_var, "plugin"); WEE_CHECK_OBJ_STR("weechat", json_var, "name"); + gui_buffer_set (gui_buffers, "input", ""); + gui_buffer_set (gui_buffers, "input_multiline", "0"); /* get one buffer by id */ snprintf (str_http, sizeof (str_http), @@ -470,6 +481,9 @@ TEST(RelayApiProtocolWithClient, CbBuffers) WEE_CHECK_OBJ_NUM(1, json, "number"); WEE_CHECK_OBJ_STR("formatted", json, "type"); WEE_CHECK_OBJ_STRN("WeeChat", 7, json, "title"); + WEE_CHECK_OBJ_STR("", json, "input"); + WEE_CHECK_OBJ_NUM(0, json, "input_position"); + WEE_CHECK_OBJ_BOOL(0, json, "input_multiline"); json_var = cJSON_GetObjectItem (json, "local_variables"); CHECK(json_var); CHECK(cJSON_IsObject (json_var)); -- cgit v1.2.3