mirror of
https://github.com/valitydev/osquery-1.git
synced 2024-11-07 18:08:53 +00:00
Add test for plist with binary
This commit is contained in:
parent
66ceec0de3
commit
e658aa5b65
@ -46,6 +46,20 @@ TEST_F(PlistTests, test_parse_plist_content) {
|
||||
}
|
||||
EXPECT_EQ(program_arguments_parsed, program_arguments);
|
||||
}
|
||||
|
||||
TEST_F(PlistTests, test_parse_plist_content_with_blobs) {
|
||||
pt::ptree tree;
|
||||
auto s = parsePlist("./osquery/filesystem/darwin/test_binary.plist", tree);
|
||||
EXPECT_TRUE(s.ok());
|
||||
EXPECT_EQ(s.toString(), "OK");
|
||||
EXPECT_THROW(tree.get<bool>("foobar"), pt::ptree_bad_path);
|
||||
EXPECT_EQ(tree.get<std::string>("SessionItems.Controller"), "CustomListItems");
|
||||
auto first_element = tree.get_child("SessionItems.CustomListItems").begin()->second;
|
||||
EXPECT_EQ(first_element.get<std::string>("Name"), "Flux");
|
||||
std::string alias = first_element.get<std::string>("Alias");
|
||||
// Verify we parsed the binary blob correctly
|
||||
EXPECT_NE(alias.find("Applications/Flux.app"), std::string::npos);
|
||||
}
|
||||
}
|
||||
|
||||
int main(int argc, char* argv[]) {
|
||||
|
BIN
osquery/filesystem/darwin/test_binary.plist
Normal file
BIN
osquery/filesystem/darwin/test_binary.plist
Normal file
Binary file not shown.
Loading…
Reference in New Issue
Block a user