Make unit tests use their own configuration rather than whatever
[dcpomatic.git] / test / config_test.cc
index 25e8c7d9dc6953ba03c4a43e7fd07813ff19fa71..cd2b196cf95ef4fb3a4a47947c0326cdca0df208 100644 (file)
@@ -19,6 +19,7 @@
 */
 
 #include "lib/config.h"
+#include "test.h"
 #include <boost/test/unit_test.hpp>
 #include <fstream>
 
@@ -30,8 +31,8 @@ rewrite_bad_config ()
        boost::system::error_code ec;
        boost::filesystem::remove ("build/test/config.xml", ec);
 
-       Config::test_path = "build/test";
-       ofstream f ("build/test/config.xml");
+       Config::override_path = "build/test/bad_config";
+       ofstream f ("build/test/bad_config/config.xml");
        f << "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
          << "<Config>\n"
          << "<Foo></Foo>\n"
@@ -87,4 +88,9 @@ BOOST_AUTO_TEST_CASE (config_backup_test)
        BOOST_CHECK (boost::filesystem::exists ("build/test/config.xml.2"));
        BOOST_CHECK (boost::filesystem::exists ("build/test/config.xml.3"));
        BOOST_CHECK (boost::filesystem::exists ("build/test/config.xml.4"));
+
+       /* This test has called Config::set_defaults(), so take us back
+          to the config that we want for our tests.
+       */
+       setup_test_config ();
 }