blob: 1b4fa86943a743d58945c60f9319273b1993c60f [file] [log] [blame]
Andrew Geissler82815da2019-02-04 12:19:41 -06001#include "src/processing.hpp"
2
3#include <gtest/gtest.h>
4
5// Verify if name is empty, false is returned
6TEST(NeedToIntrospect, PassEmptyName)
7{
Brad Bishopf944a452022-05-05 15:06:46 -04008 AllowDenyList allowList;
9 AllowDenyList denyList;
Brad Bishopa098a372022-05-05 15:19:04 -040010 std::string processName;
Andrew Geissler82815da2019-02-04 12:19:41 -060011
Brad Bishopa098a372022-05-05 15:19:04 -040012 EXPECT_FALSE(needToIntrospect(processName, allowList, denyList));
Andrew Geissler82815da2019-02-04 12:19:41 -060013}
14
Brad Bishopf944a452022-05-05 15:06:46 -040015// Verify if name is on allowlist, true is returned
16TEST(NeedToIntrospect, ValidAllowListName)
Andrew Geissler82815da2019-02-04 12:19:41 -060017{
Brad Bishopf944a452022-05-05 15:06:46 -040018 AllowDenyList allowList = {"xyz.openbmc_project"};
19 AllowDenyList denyList;
Brad Bishopa098a372022-05-05 15:19:04 -040020 std::string processName = "xyz.openbmc_project.State.Host";
Andrew Geissler82815da2019-02-04 12:19:41 -060021
Brad Bishopa098a372022-05-05 15:19:04 -040022 EXPECT_TRUE(needToIntrospect(processName, allowList, denyList));
Andrew Geissler82815da2019-02-04 12:19:41 -060023}
24
Brad Bishopf944a452022-05-05 15:06:46 -040025// Verify if name is on denylist, false is returned
26TEST(NeedToIntrospect, ValidDenyListName)
Andrew Geissler82815da2019-02-04 12:19:41 -060027{
Brad Bishopf944a452022-05-05 15:06:46 -040028 AllowDenyList allowList;
29 AllowDenyList denyList = {"xyz.openbmc_project.State.Host"};
Brad Bishopa098a372022-05-05 15:19:04 -040030 std::string processName = "xyz.openbmc_project.State.Host";
Andrew Geissler82815da2019-02-04 12:19:41 -060031
Brad Bishopa098a372022-05-05 15:19:04 -040032 EXPECT_FALSE(needToIntrospect(processName, allowList, denyList));
Andrew Geissler82815da2019-02-04 12:19:41 -060033}
34
Brad Bishopf944a452022-05-05 15:06:46 -040035// Verify if name is on allowlist and denylist, false is returned
36TEST(NeedToIntrospect, ValidAllowAndDenyListName)
Andrew Geissler82815da2019-02-04 12:19:41 -060037{
Brad Bishopf944a452022-05-05 15:06:46 -040038 AllowDenyList allowList = {"xyz.openbmc_project"};
39 AllowDenyList denyList = {"xyz.openbmc_project.State.Host"};
Brad Bishopa098a372022-05-05 15:19:04 -040040 std::string processName = "xyz.openbmc_project.State.Host";
Andrew Geissler82815da2019-02-04 12:19:41 -060041
Brad Bishopa098a372022-05-05 15:19:04 -040042 EXPECT_FALSE(needToIntrospect(processName, allowList, denyList));
Andrew Geissler82815da2019-02-04 12:19:41 -060043}