diff options
| author | Patrick Venture <venture@google.com> | 2018-10-30 12:02:53 -0700 |
|---|---|---|
| committer | Patrick Venture <venture@google.com> | 2018-10-30 20:55:34 +0000 |
| commit | f8cb464498833cc2730b1abf67e2c8006739b45d (patch) | |
| tree | 03c0f438669de9cd85a766a513daebd044073c3a /test | |
| parent | 7dbc517382bd3c2c5b60635958c18de8f1f39b4e (diff) | |
| download | phosphor-pid-control-f8cb464498833cc2730b1abf67e2c8006739b45d.tar.gz phosphor-pid-control-f8cb464498833cc2730b1abf67e2c8006739b45d.zip | |
dbus: passive: move exception checking into factory
Move the exception checking into the factory to remove possibility of
exception during construction.
Change-Id: I22922f23247c0579ee2a3411b5c8cede44fe324c
Signed-off-by: Patrick Venture <venture@google.com>
Diffstat (limited to 'test')
| -rw-r--r-- | test/dbus_passive_unittest.cpp | 21 |
1 files changed, 4 insertions, 17 deletions
diff --git a/test/dbus_passive_unittest.cpp b/test/dbus_passive_unittest.cpp index 6826ce1..52126cf 100644 --- a/test/dbus_passive_unittest.cpp +++ b/test/dbus_passive_unittest.cpp @@ -36,8 +36,7 @@ TEST(DbusPassiveTest, FactoryFailsWithInvalidType) TEST(DbusPassiveTest, BoringConstructorTest) { - // Just build the object, which should be avoided as this does no error - // checking at present. + // Simply build the object, does no error checking. sdbusplus::SdBusMock sdbus_mock; auto bus_mock = sdbusplus::get_mocked_new(&sdbus_mock); @@ -46,21 +45,9 @@ TEST(DbusPassiveTest, BoringConstructorTest) std::string path = "/xyz/openbmc_project/sensors/unknown/id"; DbusHelperMock helper; - EXPECT_CALL(helper, getService(_, StrEq(SensorIntf), StrEq(path))) - .WillOnce(Return("asdf")); - - EXPECT_CALL(helper, getProperties(_, StrEq("asdf"), StrEq(path), NotNull())) - .WillOnce( - Invoke([&](sdbusplus::bus::bus& bus, const std::string& service, - const std::string& path, struct SensorProperties* prop) { - prop->scale = -3; - prop->value = 10; - prop->unit = "x"; - })); - EXPECT_CALL(helper, thresholdsAsserted(_, StrEq("asdf"), StrEq(path))) - .WillOnce(Return(false)); - - DbusPassive(bus_mock, type, id, &helper); + struct SensorProperties properties; + + DbusPassive(bus_mock, type, id, &helper, properties, false); // Success } |

