Refactored app_config unit tests

This commit is contained in:
Scott E. Graves 2025-02-14 12:53:55 -06:00
parent 442e694d09
commit 0fffbb672a

View File

@ -215,7 +215,21 @@ static void common_tests(app_config &config, provider_type prov) {
value = cfg.get_value_by_name(JSON_API_PORT);
EXPECT_STREQ("1025", value.c_str());
}},
{JSON_API_USER, [](auto &&cfg) {}},
{JSON_API_USER,
[](app_config &cfg) {
cfg.set_api_user("");
EXPECT_STREQ("", cfg.get_api_user().c_str());
cfg.set_api_user("test");
EXPECT_STREQ("test", cfg.get_api_user().c_str());
auto value = cfg.set_value_by_name(JSON_API_USER, "test2");
EXPECT_STREQ("test2", value.c_str());
EXPECT_STREQ("test2", cfg.get_api_user().c_str());
value = cfg.get_value_by_name(JSON_API_USER);
EXPECT_STREQ("test2", value.c_str());
}},
{JSON_DOWNLOAD_TIMEOUT_SECS, [](auto &&cfg) {}},
{JSON_DATABASE_TYPE, [](auto &&cfg) {}},
{JSON_ENABLE_DOWNLOAD_TIMEOUT, [](auto &&cfg) {}},