Andrew Geissler | 82815da | 2019-02-04 12:19:41 -0600 | [diff] [blame] | 1 | #include "src/processing.hpp" |
| 2 | |
| 3 | #include <gtest/gtest.h> |
| 4 | |
| 5 | // Verify if name is empty, false is returned |
| 6 | TEST(NeedToIntrospect, PassEmptyName) |
| 7 | { |
| 8 | WhiteBlackList whiteList; |
| 9 | WhiteBlackList blackList; |
| 10 | std::string process_name; |
| 11 | |
| 12 | EXPECT_FALSE(needToIntrospect(process_name, whiteList, blackList)); |
| 13 | } |
| 14 | |
| 15 | // Verify if name is on whitelist, true is returned |
| 16 | TEST(NeedToIntrospect, ValidWhiteListName) |
| 17 | { |
| 18 | WhiteBlackList whiteList = {"xyz.openbmc_project"}; |
| 19 | WhiteBlackList blackList; |
| 20 | std::string process_name = "xyz.openbmc_project.State.Host"; |
| 21 | |
| 22 | EXPECT_TRUE(needToIntrospect(process_name, whiteList, blackList)); |
| 23 | } |
| 24 | |
| 25 | // Verify if name is on blacklist, false is returned |
| 26 | TEST(NeedToIntrospect, ValidBlackListName) |
| 27 | { |
| 28 | WhiteBlackList whiteList; |
| 29 | WhiteBlackList blackList = {"xyz.openbmc_project.State.Host"}; |
| 30 | std::string process_name = "xyz.openbmc_project.State.Host"; |
| 31 | |
| 32 | EXPECT_FALSE(needToIntrospect(process_name, whiteList, blackList)); |
| 33 | } |
| 34 | |
| 35 | // Verify if name is on whitelist and blacklist, false is returned |
| 36 | TEST(NeedToIntrospect, ValidWhiteAndBlackListName) |
| 37 | { |
| 38 | WhiteBlackList whiteList = {"xyz.openbmc_project"}; |
| 39 | WhiteBlackList blackList = {"xyz.openbmc_project.State.Host"}; |
| 40 | std::string process_name = "xyz.openbmc_project.State.Host"; |
| 41 | |
| 42 | EXPECT_FALSE(needToIntrospect(process_name, whiteList, blackList)); |
| 43 | } |