Settings hot reloading - Part 4
This commit is contained in:
@@ -50,6 +50,7 @@ async fn sql_directory() {
|
||||
store: config.stores.lookup_stores.remove(directory_id).unwrap(),
|
||||
};
|
||||
let base_store = config.stores.stores.get(directory_id).unwrap();
|
||||
let core = config.core;
|
||||
|
||||
// Create tables
|
||||
store.create_test_directory().await;
|
||||
@@ -216,27 +217,39 @@ async fn sql_directory() {
|
||||
|
||||
// Ids by email
|
||||
assert_eq!(
|
||||
handle.email_to_ids("jane@example.org").await.unwrap(),
|
||||
core.email_to_ids(&handle, "jane@example.org")
|
||||
.await
|
||||
.unwrap(),
|
||||
map_account_ids(base_store, vec!["jane"]).await
|
||||
);
|
||||
assert_eq!(
|
||||
handle.email_to_ids("info@example.org").await.unwrap(),
|
||||
core.email_to_ids(&handle, "info@example.org")
|
||||
.await
|
||||
.unwrap(),
|
||||
map_account_ids(base_store, vec!["bill", "jane", "john"]).await
|
||||
);
|
||||
assert_eq!(
|
||||
handle.email_to_ids("jane+alias@example.org").await.unwrap(),
|
||||
core.email_to_ids(&handle, "jane+alias@example.org")
|
||||
.await
|
||||
.unwrap(),
|
||||
map_account_ids(base_store, vec!["jane"]).await
|
||||
);
|
||||
assert_eq!(
|
||||
handle.email_to_ids("info+alias@example.org").await.unwrap(),
|
||||
core.email_to_ids(&handle, "info+alias@example.org")
|
||||
.await
|
||||
.unwrap(),
|
||||
map_account_ids(base_store, vec!["bill", "jane", "john"]).await
|
||||
);
|
||||
assert_eq!(
|
||||
handle.email_to_ids("unknown@example.org").await.unwrap(),
|
||||
core.email_to_ids(&handle, "unknown@example.org")
|
||||
.await
|
||||
.unwrap(),
|
||||
Vec::<u32>::new()
|
||||
);
|
||||
assert_eq!(
|
||||
handle.email_to_ids("anything@catchall.org").await.unwrap(),
|
||||
core.email_to_ids(&handle, "anything@catchall.org")
|
||||
.await
|
||||
.unwrap(),
|
||||
map_account_ids(base_store, vec!["robert"]).await
|
||||
);
|
||||
|
||||
@@ -245,32 +258,41 @@ async fn sql_directory() {
|
||||
assert!(!handle.is_local_domain("other.org").await.unwrap());
|
||||
|
||||
// RCPT TO
|
||||
assert!(handle.rcpt("jane@example.org").await.unwrap());
|
||||
assert!(handle.rcpt("info@example.org").await.unwrap());
|
||||
assert!(handle.rcpt("jane+alias@example.org").await.unwrap());
|
||||
assert!(handle.rcpt("info+alias@example.org").await.unwrap());
|
||||
assert!(handle.rcpt("random_user@catchall.org").await.unwrap());
|
||||
assert!(!handle.rcpt("invalid@example.org").await.unwrap());
|
||||
assert!(core.rcpt(&handle, "jane@example.org").await.unwrap());
|
||||
assert!(core.rcpt(&handle, "info@example.org").await.unwrap());
|
||||
assert!(core.rcpt(&handle, "jane+alias@example.org").await.unwrap());
|
||||
assert!(core.rcpt(&handle, "info+alias@example.org").await.unwrap());
|
||||
assert!(core
|
||||
.rcpt(&handle, "random_user@catchall.org")
|
||||
.await
|
||||
.unwrap());
|
||||
assert!(!core.rcpt(&handle, "invalid@example.org").await.unwrap());
|
||||
|
||||
// VRFY
|
||||
assert_eq!(
|
||||
handle.vrfy("jane").await.unwrap(),
|
||||
core.vrfy(&handle, "jane").await.unwrap(),
|
||||
vec!["jane@example.org".to_string()]
|
||||
);
|
||||
assert_eq!(
|
||||
handle.vrfy("john").await.unwrap(),
|
||||
core.vrfy(&handle, "john").await.unwrap(),
|
||||
vec!["john@example.org".to_string()]
|
||||
);
|
||||
assert_eq!(
|
||||
handle.vrfy("jane+alias@example").await.unwrap(),
|
||||
core.vrfy(&handle, "jane+alias@example").await.unwrap(),
|
||||
vec!["jane@example.org".to_string()]
|
||||
);
|
||||
assert_eq!(handle.vrfy("info").await.unwrap(), Vec::<String>::new());
|
||||
assert_eq!(handle.vrfy("invalid").await.unwrap(), Vec::<String>::new());
|
||||
assert_eq!(
|
||||
core.vrfy(&handle, "info").await.unwrap(),
|
||||
Vec::<String>::new()
|
||||
);
|
||||
assert_eq!(
|
||||
core.vrfy(&handle, "invalid").await.unwrap(),
|
||||
Vec::<String>::new()
|
||||
);
|
||||
|
||||
// EXPN
|
||||
assert_eq!(
|
||||
handle.expn("info@example.org").await.unwrap(),
|
||||
core.expn(&handle, "info@example.org").await.unwrap(),
|
||||
vec![
|
||||
"bill@example.org".to_string(),
|
||||
"jane@example.org".to_string(),
|
||||
@@ -278,7 +300,7 @@ async fn sql_directory() {
|
||||
]
|
||||
);
|
||||
assert_eq!(
|
||||
handle.expn("john@example.org").await.unwrap(),
|
||||
core.expn(&handle, "john@example.org").await.unwrap(),
|
||||
Vec::<String>::new()
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user