diff options
author | Sébastien Helleu <flashcode@flashtux.org> | 2024-05-05 23:07:42 +0200 |
---|---|---|
committer | Sébastien Helleu <flashcode@flashtux.org> | 2024-05-05 23:07:42 +0200 |
commit | 6526cc230a80d8aa05d36c70c1d97f0e7ccf182d (patch) | |
tree | bfff12cff189c65f0d63de7ae384aff9573736d2 /tests/unit/plugins/relay | |
parent | 211cd11c2a310e336ecd8760d8f33fd04dc99590 (diff) | |
download | weechat-6526cc230a80d8aa05d36c70c1d97f0e7ccf182d.zip |
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
Diffstat (limited to 'tests/unit/plugins/relay')
-rw-r--r-- | tests/unit/plugins/relay/api/test-relay-api-protocol.cpp | 14 |
1 files changed, 14 insertions, 0 deletions
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)); |