TEST(ParseGetQuery, SingleEmpty) { HttpHandler::Arguments a; HttpHandler::ParseGetQuery(a, "aaa"); ASSERT_EQ(1u, a.size()); ASSERT_EQ(a["aaa"], ""); }
TEST(ParseGetArguments, Single) { HttpHandler::Arguments a; HttpHandler::ParseGetArguments(a, "aaa=baaa"); ASSERT_EQ(1u, a.size()); ASSERT_EQ(a["aaa"], "baaa"); }
TEST(ParseGetQuery, BasicEmpty) { HttpHandler::Arguments a; HttpHandler::ParseGetQuery(a, "aaa&bb=aa&aa"); ASSERT_EQ(3u, a.size()); ASSERT_EQ(a["aaa"], ""); ASSERT_EQ(a["bb"], "aa"); ASSERT_EQ(a["aa"], ""); }
TEST(ParseGetArguments, Basic) { HttpHandler::Arguments a; HttpHandler::ParseGetArguments(a, "aaa=baaa&bb=a&aa=c"); ASSERT_EQ(3u, a.size()); ASSERT_EQ(a["aaa"], "baaa"); ASSERT_EQ(a["bb"], "a"); ASSERT_EQ(a["aa"], "c"); }
TEST(ParseGetQuery, Test2) { UriComponents uri; HttpHandler::Arguments a; HttpHandler::ParseGetQuery(uri, a, "/instances/test/world"); ASSERT_EQ(3u, uri.size()); ASSERT_EQ("instances", uri[0]); ASSERT_EQ("test", uri[1]); ASSERT_EQ("world", uri[2]); ASSERT_EQ(0u, a.size()); }
TEST(ParseGetQuery, Test1) { UriComponents uri; HttpHandler::Arguments a; HttpHandler::ParseGetQuery(uri, a, "/instances/test/world?aaa=baaa&bb=a&aa=c"); ASSERT_EQ(3u, uri.size()); ASSERT_EQ("instances", uri[0]); ASSERT_EQ("test", uri[1]); ASSERT_EQ("world", uri[2]); ASSERT_EQ(3u, a.size()); ASSERT_EQ(a["aaa"], "baaa"); ASSERT_EQ(a["bb"], "a"); ASSERT_EQ(a["aa"], "c"); }