Reduce namespace nesting (ndn::ndncert -> ndncert)

Change-Id: I5b69a2c3673cccdf07ea0ba3a0e7181894328f47
diff --git a/tests/global-configuration.cpp b/tests/global-configuration.cpp
index 61d0cbd..0c92646 100644
--- a/tests/global-configuration.cpp
+++ b/tests/global-configuration.cpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
-/**
- * Copyright (c) 2017-2020, Regents of the University of California.
+/*
+ * Copyright (c) 2017-2021, Regents of the University of California.
  *
  * This file is part of ndncert, a certificate management system based on NDN.
  *
@@ -18,12 +18,14 @@
  * See AUTHORS.md for complete list of ndncert authors and contributors.
  */
 
+#include "detail/ndncert-common.hpp"
+
 #include "boost-test.hpp"
+
 #include <boost/filesystem.hpp>
 #include <fstream>
 #include <stdlib.h>
 
-namespace ndn {
 namespace ndncert {
 namespace tests {
 
@@ -36,19 +38,22 @@
     if (envHome)
       m_home = envHome;
 
-    boost::filesystem::path dir{TMP_TESTS_PATH};
-    dir /= "test-home";
-    ::setenv("HOME", dir.c_str(), 1);
+    auto testHome = boost::filesystem::path(TMP_TESTS_PATH) / "test-home";
+    if (::setenv("HOME", testHome.c_str(), 1) != 0)
+      NDN_THROW(std::runtime_error("setenv() failed"));
 
-    boost::filesystem::create_directories(dir);
-    std::ofstream clientConf((dir / ".ndn" / "client.conf").c_str());
+    boost::filesystem::create_directories(testHome);
+
+    std::ofstream clientConf((testHome / ".ndn" / "client.conf").c_str());
     clientConf << "pib=pib-sqlite3" << std::endl
                << "tpm=tpm-file" << std::endl;
   }
 
-  ~GlobalConfiguration()
+  ~GlobalConfiguration() noexcept
   {
-    if (!m_home.empty())
+    if (m_home.empty())
+      ::unsetenv("HOME");
+    else
       ::setenv("HOME", m_home.data(), 1);
   }
 
@@ -66,4 +71,3 @@
 
 } // namespace tests
 } // namespace ndncert
-} // namespace ndn
\ No newline at end of file