diff --git a/test_package/config_test.cpp b/test_package/config_test.cpp index 6e8d0f75..be3d91a4 100644 --- a/test_package/config_test.cpp +++ b/test_package/config_test.cpp @@ -2371,4 +2371,69 @@ DevicesStyle { Location = /styles/styles.xsl } m_config->stop(); } + + TEST_F(ConfigTest, should_update_stylesheet_versions_with_path) + { + fs::path root {createTempDirectory("14")}; + + fs::path styleDir { root / "styles" }; + fs::create_directory(styleDir); + + fs::path styles { styleDir / "styles.xsl" }; + copyFile("styles/styles.xsl", styles, 0min); + + fs::path devices(root / "Devices.xml"); + copySampleFile("empty.xml", devices, 0min); + + fs::path config {root / "agent.cfg"}; + { + ofstream cfg(config.string()); + cfg << R"DOC( +SchemaVersion = 2.2 +)DOC"; + cfg << "Devices = " << devices << endl; + cfg << R"DOC( +DevicesStyle { + Location = /styles/styles.xsl + Path = ./styles/styles.xsl +} +)DOC"; + + } + + boost::program_options::variables_map options; + boost::program_options::variable_value value(boost::optional(config.string()), false); + options.insert(make_pair("config-file"s, value)); + + m_config->initialize(options); + + ifstream file(styles); + ASSERT_TRUE(file.is_open()); + + stringstream sf; + sf << file.rdbuf(); + + ASSERT_EQ(R"DOC( + + + + + + + + +)DOC", sf.str()); + + m_config->stop(); + } + } // namespace