summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPatrick Venture <venture@google.com>2019-01-07 13:28:57 -0800
committerRatan Gupta <ratagupt@linux.vnet.ibm.com>2019-03-05 11:39:32 +0000
commit3f19a51e5fcf369645585818b282a1c381b6d92c (patch)
tree720431d4bbeabb262e3979a22260eb68ece59123
parent639cfe1f509657547d594b4d38bb215b85110c50 (diff)
downloadphosphor-networkd-3f19a51e5fcf369645585818b282a1c381b6d92c.tar.gz
phosphor-networkd-3f19a51e5fcf369645585818b282a1c381b6d92c.zip
test: use mocked sdbus interface for sdbusplus
Use mocked sdbus interface for sdbusplus such that it doesn't require talking to the real dbus interfaces. The warnings for the unexpected calls on the sdbus interface can be ignored in the cases for this test as returning 0 is the desired behavior. The warnings can be trivially handled by expecting the calls, or setting up "ON_CALL" statements. Change-Id: I8c72eaec957fb6a68eeaac982c1f45998487c35f Signed-off-by: Patrick Venture <venture@google.com>
-rw-r--r--test/test_network_manager.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/test/test_network_manager.cpp b/test/test_network_manager.cpp
index ff0840e..f1cfa64 100644
--- a/test/test_network_manager.cpp
+++ b/test/test_network_manager.cpp
@@ -8,7 +8,7 @@
#include <exception>
#include <experimental/filesystem>
-#include <sdbusplus/bus.hpp>
+#include <sdbusplus/test/sdbus_mock.hpp>
#include <xyz/openbmc_project/Common/error.hpp>
#include <gtest/gtest.h>
@@ -26,11 +26,12 @@ namespace fs = std::experimental::filesystem;
class TestNetworkManager : public testing::Test
{
public:
+ sdbusplus::SdBusMock sdbus_mock;
sdbusplus::bus::bus bus;
Manager manager;
std::string confDir;
TestNetworkManager() :
- bus(sdbusplus::bus::new_default()),
+ bus(sdbusplus::get_mocked_new(&sdbus_mock)),
manager(bus, "/xyz/openbmc_test/abc", "/tmp")
{
setConfDir();
OpenPOWER on IntegriCloud