test: use real manager object for testing

Use the real manager object for testing the manager object instead of a
derived object.

Change-Id: I3b4a401d43457bffb22de8fac5e29b2e2887c6c6
Signed-off-by: Patrick Venture <venture@google.com>
diff --git a/network_manager.hpp b/network_manager.hpp
index a4d066c..e2dfea9 100644
--- a/network_manager.hpp
+++ b/network_manager.hpp
@@ -118,6 +118,25 @@
      */
     virtual void restartSystemdUnit(const std::string& unit);
 
+    /** @brief Returns the number of interfaces under this manager.
+     *
+     * @return the number of interfaces managed by this manager.
+     */
+    int getInterfaceCount()
+    {
+        return interfaces.size();
+    }
+
+    /** @brief Does the requested interface exist under this manager?
+     *
+     * @param[in] intf - the interface name to check.
+     * @return true if found, false otherwise.
+     */
+    bool hasInterface(const std::string& intf)
+    {
+        return (interfaces.find(intf) != interfaces.end());
+    }
+
   protected:
     /** @brief Persistent sdbusplus DBus bus connection. */
     sdbusplus::bus::bus& bus;
diff --git a/test/mock_network_manager.hpp b/test/mock_network_manager.hpp
index a71301e..141469b 100644
--- a/test/mock_network_manager.hpp
+++ b/test/mock_network_manager.hpp
@@ -20,7 +20,6 @@
 
     MOCK_METHOD1(restartSystemdUnit, void(const std::string& service));
 
-    friend class TestNetworkManager;
     friend class TestRtNetlink;
 };
 
diff --git a/test/test_network_manager.cpp b/test/test_network_manager.cpp
index 911a1bd..b68aa44 100644
--- a/test/test_network_manager.cpp
+++ b/test/test_network_manager.cpp
@@ -27,7 +27,7 @@
 {
   public:
     sdbusplus::bus::bus bus;
-    MockManager manager;
+    Manager manager;
     std::string confDir;
     TestNetworkManager() :
         bus(sdbusplus::bus::new_default()),
@@ -55,18 +55,6 @@
     {
         manager.createInterfaces();
     }
-
-    int getSize()
-    {
-        return manager.interfaces.size();
-    }
-
-    bool isInterfaceAdded(std::string intf)
-    {
-        return manager.interfaces.find(intf) != manager.interfaces.end()
-                   ? true
-                   : false;
-    }
 };
 
 // getifaddrs will not return any interface
@@ -99,8 +87,8 @@
         // Now create the interfaces which will call the mocked getifaddrs
         // which returns the above interface detail.
         createInterfaces();
-        EXPECT_EQ(1, getSize());
-        EXPECT_EQ(true, isInterfaceAdded("igb1"));
+        EXPECT_EQ(1, manager.getInterfaceCount());
+        EXPECT_EQ(true, manager.hasInterface("igb1"));
     }
     catch (std::exception& e)
     {
@@ -121,8 +109,8 @@
                    IFF_UP | IFF_RUNNING);
 
         createInterfaces();
-        EXPECT_EQ(2, getSize());
-        EXPECT_EQ(true, isInterfaceAdded("igb0"));
+        EXPECT_EQ(2, manager.getInterfaceCount());
+        EXPECT_EQ(true, manager.hasInterface("igb0"));
     }
     catch (std::exception& e)
     {