22 #include <gtest/gtest.h>
29 static std::string gl_data_path;
42 "RemoteControlSecurity1.xml");
43 sec1 = std::make_shared<RemoteControlSecurity>(
44 cfg_tree.get_child(
"kernel.remote"));
47 "RemoteControlSecurity2.xml");
48 sec2 = std::make_shared<RemoteControlSecurity>(
49 cfg_tree.get_child(
"kernel.remote"));
53 std::shared_ptr<RemoteControlSecurity>
sec1;
54 std::shared_ptr<RemoteControlSecurity>
sec2;
60 ASSERT_TRUE(sec1->allow_request(
"Llama",
"SYNC_FROM"));
61 ASSERT_TRUE(sec1->allow_request(
"Llama",
"MODULE_CONFIG"));
63 ASSERT_TRUE(sec1->allow_request(
"Llama",
"HAHAHAHAHHA"));
65 ASSERT_FALSE(sec1->allow_request(
"Worm",
"SYNC_FROM"));
66 ASSERT_TRUE(sec1->allow_request(
"Worm",
"MODULE_CONFIG"));
67 ASSERT_TRUE(sec1->allow_request(
"Worm",
"MODULE_LIST"));
68 ASSERT_FALSE(sec1->allow_request(
"Worm",
"HAHAHAHAHHA"));
70 ASSERT_FALSE(sec1->allow_request(
"LlamaWorm",
"SYNC_FROM"));
71 ASSERT_FALSE(sec1->allow_request(
"LlamaWorm",
"MODULE_CONFIG"));
72 ASSERT_FALSE(sec1->allow_request(
"LlamaWorm",
"HAHAHAHAHHA"));
81 ASSERT_TRUE(sec2->allow_request(
"Llama",
"SYNC_FROM"));
82 ASSERT_TRUE(sec2->allow_request(
"Llama",
"MODULE_CONFIG"));
84 ASSERT_TRUE(sec2->allow_request(
"Llama",
"HAHAHAHAHHA"));
86 ASSERT_TRUE(sec2->allow_request(
"Worm",
"SYNC_FROM"));
87 ASSERT_TRUE(sec2->allow_request(
"Worm",
"MODULE_CONFIG"));
88 ASSERT_TRUE(sec1->allow_request(
"Worm",
"MODULE_LIST"));
89 ASSERT_TRUE(sec2->allow_request(
"Worm",
"HAHAHAHAHHA"));
91 ASSERT_TRUE(sec2->allow_request(
"LlamaWorm",
"SYNC_FROM"));
92 ASSERT_TRUE(sec2->allow_request(
"LlamaWorm",
"MODULE_CONFIG"));
93 ASSERT_TRUE(sec2->allow_request(
"LlamaWorm",
"HAHAHAHAHHA"));
98 int main(
int argc,
char **argv)
100 ::testing::InitGoogleTest(&argc, argv);
105 gl_data_path = std::string(argv[1]) +
'/';
106 return RUN_ALL_TESTS();