tests: Extending Face test cases

Add previously removed test cases to check if config-file based
transport customization works.

Change-Id: I7e2235494f2ba7011423e743ab8e437c74d56d1f
diff --git a/tests/key-chain-fixture.hpp b/tests/key-chain-fixture.hpp
index bf4e004..e9218a6 100644
--- a/tests/key-chain-fixture.hpp
+++ b/tests/key-chain-fixture.hpp
@@ -28,6 +28,8 @@
 #include "identity-management-fixture.hpp"
 
 #include <boost/filesystem.hpp>
+#include <boost/algorithm/string.hpp>
+#include <fstream>
 
 namespace ndn {
 namespace tests {
@@ -84,6 +86,36 @@
   std::string m_oldTpm;
 };
 
+/**
+ * @brief Extension of PibDirFixture to set TEST_HOME variable and allow config file creation
+ */
+template<class Path>
+class TestHomeFixture : public PibDirFixture<Path>
+{
+public:
+  TestHomeFixture()
+  {
+    setenv("TEST_HOME", this->m_pibDir.c_str(), true);
+  }
+
+  ~TestHomeFixture()
+  {
+    unsetenv("TEST_HOME");
+  }
+
+  void
+  createClientConf(std::initializer_list<std::string> lines)
+  {
+    boost::filesystem::create_directories(boost::filesystem::path(this->m_pibDir) / ".ndn");
+    std::ofstream of((boost::filesystem::path(this->m_pibDir) / ".ndn" / "client.conf").c_str());
+    for (auto line : lines) {
+      boost::replace_all(line, "%PATH%", this->m_pibDir);
+      of << line << std::endl;
+    }
+  }
+};
+
+
 struct DefaultPibDir
 {
   const std::string PATH = "build/keys";
@@ -99,6 +131,7 @@
   KeyChainFixture();
 };
 
+
 } // namespace tests
 } // namespace ndn