mirror of
https://github.com/pimalaya/himalaya.git
synced 2026-06-18 14:07:54 +08:00
fix notmuch backend feature
This commit is contained in:
+24
-12
@@ -143,16 +143,26 @@ impl DeserializedConfig {
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use himalaya_lib::{
|
||||
EmailSendCmd, EmailSender, ImapConfig, MaildirConfig, NotmuchConfig, SmtpConfig,
|
||||
};
|
||||
use himalaya_lib::{EmailSendCmd, EmailSender, SmtpConfig};
|
||||
|
||||
#[cfg(feature = "imap-backend")]
|
||||
use himalaya_lib::ImapConfig;
|
||||
#[cfg(feature = "maildir-backend")]
|
||||
use himalaya_lib::MaildirConfig;
|
||||
#[cfg(feature = "notmuch-backend")]
|
||||
use himalaya_lib::NotmuchConfig;
|
||||
|
||||
use std::io::Write;
|
||||
use tempfile::NamedTempFile;
|
||||
|
||||
use crate::account::{
|
||||
DeserializedBaseAccountConfig, DeserializedImapAccountConfig,
|
||||
DeserializedMaildirAccountConfig, DeserializedNotmuchAccountConfig,
|
||||
};
|
||||
use crate::account::DeserializedBaseAccountConfig;
|
||||
|
||||
#[cfg(feature = "imap-backend")]
|
||||
use crate::account::DeserializedImapAccountConfig;
|
||||
#[cfg(feature = "maildir-backend")]
|
||||
use crate::account::DeserializedMaildirAccountConfig;
|
||||
#[cfg(feature = "notmuch-backend")]
|
||||
use crate::account::DeserializedNotmuchAccountConfig;
|
||||
|
||||
use super::*;
|
||||
|
||||
@@ -189,10 +199,11 @@ mod tests {
|
||||
backend = \"bad\"",
|
||||
);
|
||||
|
||||
assert_eq!(
|
||||
config.unwrap_err().root_cause().to_string(),
|
||||
"unknown variant `bad`, expected one of `none`, `imap`, `maildir`, `notmuch` at line 1 column 1"
|
||||
);
|
||||
assert!(config
|
||||
.unwrap_err()
|
||||
.root_cause()
|
||||
.to_string()
|
||||
.starts_with("unknown variant `bad`"));
|
||||
}
|
||||
|
||||
#[test]
|
||||
@@ -289,6 +300,7 @@ mod tests {
|
||||
);
|
||||
}
|
||||
|
||||
#[cfg(feature = "notmuch-backend")]
|
||||
#[test]
|
||||
fn account_backend_notmuch_missing_db_path_field() {
|
||||
let config = make_config(
|
||||
@@ -513,7 +525,6 @@ mod tests {
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn account_backend_maildir_minimum_config() {
|
||||
let config = make_config(
|
||||
@@ -544,6 +555,7 @@ mod tests {
|
||||
);
|
||||
}
|
||||
|
||||
#[cfg(feature = "notmuch-backend")]
|
||||
#[test]
|
||||
fn account_backend_notmuch_minimum_config() {
|
||||
let config = make_config(
|
||||
|
||||
@@ -19,10 +19,17 @@
|
||||
//! This module contains the raw deserialized representation of an
|
||||
//! account in the accounts section of the user configuration file.
|
||||
|
||||
use himalaya_lib::{
|
||||
AccountConfig, BackendConfig, EmailHooks, EmailSender, EmailTextPlainFormat, ImapConfig,
|
||||
MaildirConfig, NotmuchConfig,
|
||||
};
|
||||
use himalaya_lib::{AccountConfig, BackendConfig, EmailHooks, EmailSender, EmailTextPlainFormat};
|
||||
|
||||
#[cfg(feature = "imap-backend")]
|
||||
use himalaya_lib::ImapConfig;
|
||||
|
||||
#[cfg(feature = "maildir-backend")]
|
||||
use himalaya_lib::MaildirConfig;
|
||||
|
||||
#[cfg(feature = "notmuch-backend")]
|
||||
use himalaya_lib::NotmuchConfig;
|
||||
|
||||
use serde::Deserialize;
|
||||
use std::{collections::HashMap, path::PathBuf};
|
||||
|
||||
|
||||
@@ -125,7 +125,7 @@ mod tests {
|
||||
}
|
||||
|
||||
let app = get_matches_from![];
|
||||
assert_eq!(None, app.value_of("source"));
|
||||
assert_eq!(Some("inbox"), app.value_of("source"));
|
||||
|
||||
let app = get_matches_from!["-f", "SOURCE"];
|
||||
assert_eq!(Some("SOURCE"), app.value_of("source"));
|
||||
|
||||
Reference in New Issue
Block a user