update(engine): add tests for decode_url()

Signed-off-by: Luca Guerra <luca@guerra.sh>
This commit is contained in:
Luca Guerra 2023-11-14 17:08:29 +00:00 committed by poiana
parent 8bf40cdf88
commit f073a6ee88

View File

@ -72,3 +72,22 @@ TEST(FalcoUtils, parse_prometheus_interval)
*/ */
ASSERT_EQ(falco::utils::parse_prometheus_interval("200"), 0UL); ASSERT_EQ(falco::utils::parse_prometheus_interval("200"), 0UL);
} }
TEST(FalcoUtils, decode_url)
{
ASSERT_EQ(
falco::utils::decode_uri("https://www.example.com?key1=value+1&key2=value%40%21%242&key3=value%253", true),
"https://www.example.com?key1=value 1&key2=value@!$2&key3=value%3");
ASSERT_EQ(
falco::utils::decode_uri("https://download.falco.org/?prefix=driver/3.0.1%2Bdriver/x86_64/", true),
"https://download.falco.org/?prefix=driver/3.0.1+driver/x86_64/");
ASSERT_EQ(
falco::utils::decode_uri("https://example.com/hello%20world", true),
"https://example.com/hello world");
ASSERT_EQ(
falco::utils::decode_uri("https://example.com/helloworld", true),
"https://example.com/helloworld");
}