test: validate unknown config warning with valid inputs

pull/370/head
zijiren233 2 months ago
parent fa1b604b92
commit 6833e5a928
No known key found for this signature in database
GPG Key ID: 534E082AAA9B39DC

@ -155,6 +155,8 @@ fn sample_config() -> crate::app_config::AppConfig {
config.jwt.secret = "jwt-secret-123456789012345678901234".into();
config.security.opaque_server_setup_secret =
"opaque-server-setup-secret-123456789012345678901234".into();
config.security.credential_encryption_key =
"4444444444444444444444444444444444444444444444444444444444444444".into();
config.security.email_outbox_encryption_key =
"5555555555555555555555555555555555555555555555555555555555555555".into();
config.security.totp_encryption_key =
@ -205,7 +207,17 @@ fn cli_parses_global_data_dir() {
fn serve_config_context_warns_on_unknown_inputs() {
let _env_lock = acquire_env_test_lock();
let _unknown_env = EnvVarGuard::set("SYNCTV_UNKNOWN_BOOT_FLAG", "1");
let mut config_file = tempfile::Builder::new()
.suffix(".yaml")
.tempfile()
.expect("temporary config file should be created");
serde_yaml::to_writer(&mut config_file, &sample_config())
.expect("sample config should be serialized");
config_file
.flush()
.expect("sample config should be written");
let context = CliConfigContext::new(GlobalConfigArgs {
config: Some(config_file.path().to_path_buf()),
no_dotenv: true,
..GlobalConfigArgs::default()
});

Loading…
Cancel
Save