updated unit test
Some checks are pending
BlockStorage/repertory/pipeline/head Build queued...

This commit is contained in:
2025-08-31 07:29:38 -05:00
parent 91463bcac0
commit bbdf8ebad8

View File

@@ -52,19 +52,26 @@ TEST(json_serialize_test, can_handle_directory_item) {
} }
TEST(json_serialize_test, can_handle_encrypt_config) { TEST(json_serialize_test, can_handle_encrypt_config) {
auto kdf_cfg = utils::encryption::kdf_config{};
kdf_cfg.seal();
encrypt_config cfg{ encrypt_config cfg{
.encryption_token = "token", .encryption_token = "token",
.kdf_cfg = kdf_cfg,
.path = "path", .path = "path",
}; };
json data(cfg); json data(cfg);
EXPECT_STREQ("token", EXPECT_STREQ("token",
data.at(JSON_ENCRYPTION_TOKEN).get<std::string>().c_str()); data.at(JSON_ENCRYPTION_TOKEN).get<std::string>().c_str());
EXPECT_STREQ(utils::collection::to_hex_string(kdf_cfg.to_header()).c_str(),
data.at(JSON_PATH).get<std::string>().c_str());
EXPECT_STREQ("path", data.at(JSON_PATH).get<std::string>().c_str()); EXPECT_STREQ("path", data.at(JSON_PATH).get<std::string>().c_str());
{ {
auto cfg2 = data.get<encrypt_config>(); auto cfg2 = data.get<encrypt_config>();
EXPECT_STREQ(cfg2.encryption_token.c_str(), cfg.encryption_token.c_str()); EXPECT_STREQ(cfg2.encryption_token.c_str(), cfg.encryption_token.c_str());
EXPECT_EQ(cfg2.kdf_cfg, cfg.kdf_cfg);
EXPECT_STREQ(cfg2.path.c_str(), cfg.path.c_str()); EXPECT_STREQ(cfg2.path.c_str(), cfg.path.c_str());
} }
} }