Refactored app_config unit tests
All checks were successful
BlockStorage/repertory/pipeline/head This commit looks good

This commit is contained in:
Scott E. Graves 2025-02-14 13:00:14 -06:00
parent 0fffbb672a
commit 51d094a385

View File

@ -230,7 +230,26 @@ static void common_tests(app_config &config, provider_type prov) {
value = cfg.get_value_by_name(JSON_API_USER);
EXPECT_STREQ("test2", value.c_str());
}},
{JSON_DOWNLOAD_TIMEOUT_SECS, [](auto &&cfg) {}},
{JSON_DOWNLOAD_TIMEOUT_SECS,
[](app_config &cfg) {
cfg.set_download_timeout_secs(min_download_timeout_secs);
EXPECT_EQ(std::uint8_t(min_download_timeout_secs),
cfg.get_download_timeout_secs());
cfg.set_download_timeout_secs(min_download_timeout_secs + 1U);
EXPECT_EQ(std::uint8_t(min_download_timeout_secs + 1U),
cfg.get_download_timeout_secs());
auto value = cfg.set_value_by_name(JSON_DOWNLOAD_TIMEOUT_SECS, "26");
EXPECT_STREQ("26", value.c_str());
EXPECT_EQ(std::uint8_t(26U), cfg.get_download_timeout_secs());
value = cfg.get_value_by_name(JSON_DOWNLOAD_TIMEOUT_SECS);
EXPECT_STREQ("26", value.c_str());
cfg.set_download_timeout_secs(min_download_timeout_secs - 1U);
EXPECT_EQ(min_download_timeout_secs, cfg.get_download_timeout_secs());
}},
{JSON_DATABASE_TYPE, [](auto &&cfg) {}},
{JSON_ENABLE_DOWNLOAD_TIMEOUT, [](auto &&cfg) {}},
{JSON_ENABLE_DRIVE_EVENTS, [](auto &&cfg) {}},