1
0
mirror of https://github.com/weechat/weechat.git synced 2026-07-05 01:03:14 +02:00

relay/api: return an error 400 when URL parameter "colors" has an invalid value

This commit is contained in:
Sébastien Helleu
2025-10-26 07:10:30 +01:00
parent 8eed89c43c
commit 58c873809b
6 changed files with 87 additions and 14 deletions
@@ -41,12 +41,14 @@ TEST_GROUP(RelayApi)
TEST(RelayApi, SearchColors)
{
LONGS_EQUAL(RELAY_API_COLORS_ANSI, relay_api_search_colors (NULL));
LONGS_EQUAL(RELAY_API_COLORS_ANSI, relay_api_search_colors (""));
LONGS_EQUAL(RELAY_API_COLORS_ANSI, relay_api_search_colors ("xxx"));
LONGS_EQUAL(RELAY_API_COLORS_ANSI, relay_api_search_colors ("WEECHAT"));
LONGS_EQUAL(RELAY_API_COLORS_ANSI, relay_api_search_colors ("STRIP"));
LONGS_EQUAL(-1, relay_api_search_colors (NULL));
LONGS_EQUAL(-1, relay_api_search_colors (""));
LONGS_EQUAL(-1, relay_api_search_colors ("xxx"));
LONGS_EQUAL(-1, relay_api_search_colors ("ANSI"));
LONGS_EQUAL(-1, relay_api_search_colors ("WEECHAT"));
LONGS_EQUAL(-1, relay_api_search_colors ("STRIP"));
LONGS_EQUAL(RELAY_API_COLORS_ANSI, relay_api_search_colors ("ansi"));
LONGS_EQUAL(RELAY_API_COLORS_WEECHAT, relay_api_search_colors ("weechat"));
LONGS_EQUAL(RELAY_API_COLORS_STRIP, relay_api_search_colors ("strip"));
}