예제 #1
0
TEST_F(TestSite, Location)
{
    Site s = Site::create(m_engine, "test");
    ASSERT_TRUE(s);

    Location l = s.create_location("foo");
    ASSERT_TRUE(l);
    EXPECT_EQ(s, l.site());
    EXPECT_EQ(string("foo"), l.path());

    l.set_path("bar");
    EXPECT_EQ(string("bar"), l.path());

    l = s.create_default_location();
    EXPECT_EQ(s, l.site());
}
예제 #2
0
TEST_F(TestSite, Site)
{
    Site s = Site::create(m_engine, "test");
    ASSERT_TRUE(s);

    EXPECT_EQ(string("test"), s.name());
    EXPECT_EQ(m_engine, s.engine());
    EXPECT_TRUE(s.memory_pool());

    Location l = s.create_default_location();
    EXPECT_EQ(l, s.default_location());

    s.add_ip("1.2.3.4");
    EXPECT_EQ(1UL, s.ips().size());
    EXPECT_EQ(string("1.2.3.4"), s.ips().front());

    s.add_host("foo");
    EXPECT_EQ(1UL, s.hosts().size());
    EXPECT_EQ(string("foo"), s.hosts().front());

    l = s.create_location("/foo");
    EXPECT_EQ(1UL, s.locations().size());
    EXPECT_EQ(l, s.locations().front());
}