mirror of
https://github.com/soywod/himalaya.git
synced 2024-07-20 07:01: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]]
|
[[package]]
|
||||||
name = "himalaya-lib"
|
name = "himalaya-lib"
|
||||||
version = "0.2.0"
|
version = "0.2.1"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "725a54202cadc90ba876d8317ea17c035df3060c5fb18c5dcf4e74bf4362e5ce"
|
checksum = "a0b8afc6ba5f717638aa023bbe082e46fda3ec261c1ce9b21cb9a6c5e9133cd9"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"ammonia",
|
"ammonia",
|
||||||
"chrono",
|
"chrono",
|
||||||
|
|
|
@ -18,7 +18,7 @@ section = "mail"
|
||||||
[features]
|
[features]
|
||||||
imap-backend = ["imap", "imap-proto"]
|
imap-backend = ["imap", "imap-proto"]
|
||||||
maildir-backend = ["maildir", "md5"]
|
maildir-backend = ["maildir", "md5"]
|
||||||
notmuch-backend = ["notmuch", "maildir-backend"]
|
notmuch-backend = ["himalaya-lib/notmuch-backend", "maildir-backend", "notmuch"]
|
||||||
default = ["imap-backend", "maildir-backend"]
|
default = ["imap-backend", "maildir-backend"]
|
||||||
|
|
||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
|
@ -33,7 +33,7 @@ clap = { version = "2.33.3", default-features = false, features = ["suggestions"
|
||||||
convert_case = "0.5.0"
|
convert_case = "0.5.0"
|
||||||
env_logger = "0.8.3"
|
env_logger = "0.8.3"
|
||||||
erased-serde = "0.3.18"
|
erased-serde = "0.3.18"
|
||||||
himalaya-lib = "=0.2.0"
|
himalaya-lib = "=0.2.1"
|
||||||
html-escape = "0.2.9"
|
html-escape = "0.2.9"
|
||||||
lettre = { version = "=0.10.0-rc.7", features = ["serde"] }
|
lettre = { version = "=0.10.0-rc.7", features = ["serde"] }
|
||||||
log = "0.4.14"
|
log = "0.4.14"
|
||||||
|
|
|
@ -143,16 +143,26 @@ impl DeserializedConfig {
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
use himalaya_lib::{
|
use himalaya_lib::{EmailSendCmd, EmailSender, SmtpConfig};
|
||||||
EmailSendCmd, EmailSender, ImapConfig, MaildirConfig, NotmuchConfig, 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 std::io::Write;
|
||||||
use tempfile::NamedTempFile;
|
use tempfile::NamedTempFile;
|
||||||
|
|
||||||
use crate::account::{
|
use crate::account::DeserializedBaseAccountConfig;
|
||||||
DeserializedBaseAccountConfig, DeserializedImapAccountConfig,
|
|
||||||
DeserializedMaildirAccountConfig, DeserializedNotmuchAccountConfig,
|
#[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::*;
|
use super::*;
|
||||||
|
|
||||||
|
@ -189,10 +199,11 @@ mod tests {
|
||||||
backend = \"bad\"",
|
backend = \"bad\"",
|
||||||
);
|
);
|
||||||
|
|
||||||
assert_eq!(
|
assert!(config
|
||||||
config.unwrap_err().root_cause().to_string(),
|
.unwrap_err()
|
||||||
"unknown variant `bad`, expected one of `none`, `imap`, `maildir`, `notmuch` at line 1 column 1"
|
.root_cause()
|
||||||
);
|
.to_string()
|
||||||
|
.starts_with("unknown variant `bad`"));
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
@ -289,6 +300,7 @@ mod tests {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[cfg(feature = "notmuch-backend")]
|
||||||
#[test]
|
#[test]
|
||||||
fn account_backend_notmuch_missing_db_path_field() {
|
fn account_backend_notmuch_missing_db_path_field() {
|
||||||
let config = make_config(
|
let config = make_config(
|
||||||
|
@ -513,7 +525,6 @@ mod tests {
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn account_backend_maildir_minimum_config() {
|
fn account_backend_maildir_minimum_config() {
|
||||||
let config = make_config(
|
let config = make_config(
|
||||||
|
@ -544,6 +555,7 @@ mod tests {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[cfg(feature = "notmuch-backend")]
|
||||||
#[test]
|
#[test]
|
||||||
fn account_backend_notmuch_minimum_config() {
|
fn account_backend_notmuch_minimum_config() {
|
||||||
let config = make_config(
|
let config = make_config(
|
||||||
|
|
|
@ -19,10 +19,17 @@
|
||||||
//! This module contains the raw deserialized representation of an
|
//! This module contains the raw deserialized representation of an
|
||||||
//! account in the accounts section of the user configuration file.
|
//! account in the accounts section of the user configuration file.
|
||||||
|
|
||||||
use himalaya_lib::{
|
use himalaya_lib::{AccountConfig, BackendConfig, EmailHooks, EmailSender, EmailTextPlainFormat};
|
||||||
AccountConfig, BackendConfig, EmailHooks, EmailSender, EmailTextPlainFormat, ImapConfig,
|
|
||||||
MaildirConfig, NotmuchConfig,
|
#[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 serde::Deserialize;
|
||||||
use std::{collections::HashMap, path::PathBuf};
|
use std::{collections::HashMap, path::PathBuf};
|
||||||
|
|
||||||
|
|
|
@ -125,7 +125,7 @@ mod tests {
|
||||||
}
|
}
|
||||||
|
|
||||||
let app = get_matches_from![];
|
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"];
|
let app = get_matches_from!["-f", "SOURCE"];
|
||||||
assert_eq!(Some("SOURCE"), app.value_of("source"));
|
assert_eq!(Some("SOURCE"), app.value_of("source"));
|
||||||
|
|
Loading…
Reference in a new issue