Update for new libweave
Interface was changed by:
ac18fcf Merge: Add write callback into SaveSettings function
d1e6c4f Merge: Add |name| into LoadSettings/SaveSettings
LoadSettings/SaveSettings expect name of config.
SaveSettings expects callback.
Change-Id: I0dc39ac013645bad48acb2a89e93b472ff014718
diff --git a/buffet/buffet_config_unittest.cc b/buffet/buffet_config_unittest.cc
index bc4384e..a11ff4d 100644
--- a/buffet/buffet_config_unittest.cc
+++ b/buffet/buffet_config_unittest.cc
@@ -125,36 +125,36 @@
};
TEST_F(BuffetConfigTestWithFakes, EncryptionEnabled) {
- config_->SaveSettings("test");
- ASSERT_NE("test", fake_file_content_["settings_file"]);
- ASSERT_EQ("test", config_->LoadSettings());
+ config_->SaveSettings("config", "test", {});
+ ASSERT_NE("test", fake_file_content_["settings_file.config"]);
+ ASSERT_EQ("test", config_->LoadSettings("config"));
}
TEST_F(BuffetConfigTestWithFakes, EncryptionFailure) {
- config_->SaveSettings("test");
- ASSERT_FALSE(fake_file_content_["settings_file"].empty());
+ config_->SaveSettings("config", "test", {});
+ ASSERT_FALSE(fake_file_content_["settings_file.config"].empty());
encryptor_result_ = false;
- config_->SaveSettings("test2");
+ config_->SaveSettings("config", "test2", {});
// Encryption fails -> file cleared.
- ASSERT_TRUE(fake_file_content_["settings_file"].empty());
+ ASSERT_TRUE(fake_file_content_["settings_file.config"].empty());
}
TEST_F(BuffetConfigTestWithFakes, DecryptionFailure) {
- config_->SaveSettings("test");
- ASSERT_FALSE(fake_file_content_["settings_file"].empty());
+ config_->SaveSettings("config", "test", {});
+ ASSERT_FALSE(fake_file_content_["settings_file.config"].empty());
encryptor_result_ = false;
// Decryption fails -> empty settings loaded.
- ASSERT_TRUE(config_->LoadSettings().empty());
+ ASSERT_TRUE(config_->LoadSettings("config").empty());
}
TEST_F(BuffetConfigTestWithFakes, SettingsIOFailure) {
- config_->SaveSettings("test");
- std::string original = fake_file_content_["settings_file"];
+ config_->SaveSettings("config", "test", {});
+ std::string original = fake_file_content_["settings_file.config"];
ASSERT_FALSE(original.empty());
io_result_ = false;
- ASSERT_TRUE(config_->LoadSettings().empty());
- config_->SaveSettings("test2");
- ASSERT_EQ(original, fake_file_content_["settings_file"]);
+ ASSERT_TRUE(config_->LoadSettings("config").empty());
+ config_->SaveSettings("config2", "test", {});
+ ASSERT_EQ(original, fake_file_content_["settings_file.config"]);
}
} // namespace buffet