mirror of
https://github.com/soywod/himalaya.git
synced 2024-07-05 17:15:12 +00:00
fix notmuch backend feature
This commit is contained in:
parent
cdc0e0aa6a
commit
4fe5d246f1
4
Cargo.lock
generated
4
Cargo.lock
generated
|
@ -473,9 +473,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "himalaya-lib"
|
||||
version = "0.2.0"
|
||||
version = "0.2.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "725a54202cadc90ba876d8317ea17c035df3060c5fb18c5dcf4e74bf4362e5ce"
|
||||
checksum = "a0b8afc6ba5f717638aa023bbe082e46fda3ec261c1ce9b21cb9a6c5e9133cd9"
|
||||
dependencies = [
|
||||
"ammonia",
|
||||
"chrono",
|
||||
|
|
|
@ -18,7 +18,7 @@ section = "mail"
|
|||
[features]
|
||||
imap-backend = ["imap", "imap-proto"]
|
||||
maildir-backend = ["maildir", "md5"]
|
||||
notmuch-backend = ["notmuch", "maildir-backend"]
|
||||
notmuch-backend = ["himalaya-lib/notmuch-backend", "maildir-backend", "notmuch"]
|
||||
default = ["imap-backend", "maildir-backend"]
|
||||
|
||||
[dev-dependencies]
|
||||
|
@ -33,7 +33,7 @@ clap = { version = "2.33.3", default-features = false, features = ["suggestions"
|
|||
convert_case = "0.5.0"
|
||||
env_logger = "0.8.3"
|
||||
erased-serde = "0.3.18"
|
||||
himalaya-lib = "=0.2.0"
|
||||
himalaya-lib = "=0.2.1"
|
||||
html-escape = "0.2.9"
|
||||
lettre = { version = "=0.10.0-rc.7", features = ["serde"] }
|
||||
log = "0.4.14"
|
||||
|
|
|
@ -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"));
|
||||
|
|
Loading…
Reference in a new issue