Box large futures
This commit is contained in:
@@ -23,201 +23,194 @@ pub mod files;
|
||||
pub mod mail;
|
||||
pub mod principal;
|
||||
|
||||
#[test]
|
||||
fn jmap_tests() {
|
||||
tokio::runtime::Builder::new_multi_thread()
|
||||
.thread_stack_size(8 * 1024 * 1024) // 8MB stack
|
||||
.enable_all()
|
||||
#[tokio::test(flavor = "multi_thread")]
|
||||
pub async fn jmap_tests() {
|
||||
let mut test = TestServerBuilder::new("jmap_tests")
|
||||
.await
|
||||
.with_default_listeners()
|
||||
.await
|
||||
.build()
|
||||
.unwrap()
|
||||
.block_on(async {
|
||||
let mut test = TestServerBuilder::new("jmap_tests")
|
||||
.await
|
||||
.with_default_listeners()
|
||||
.await
|
||||
.build()
|
||||
.await;
|
||||
.await;
|
||||
|
||||
// Create admin account
|
||||
let admin = test.create_admin_account("admin@example.com").await;
|
||||
// Create admin account
|
||||
let admin = test.create_admin_account("admin@example.com").await;
|
||||
|
||||
// Create test users
|
||||
for (name, secret, description, aliases) in [
|
||||
(
|
||||
"jdoe@example.com",
|
||||
"12345 + extra safety",
|
||||
"John Doe",
|
||||
&["john.doe@example.com"][..],
|
||||
),
|
||||
(
|
||||
"jane.smith@example.com",
|
||||
"abcde + extra safety",
|
||||
"Jane Smith",
|
||||
&["jane@example.com"],
|
||||
),
|
||||
(
|
||||
"bill@example.com",
|
||||
"098765 + extra safety",
|
||||
"Bill Foobar",
|
||||
&["bill.foobar@example.com"],
|
||||
),
|
||||
(
|
||||
"robert@example.com",
|
||||
"aabbcc + extra safety",
|
||||
"Robert Foobar",
|
||||
&[][..],
|
||||
),
|
||||
] {
|
||||
let account = admin
|
||||
.create_user_account(
|
||||
name,
|
||||
secret,
|
||||
description,
|
||||
aliases,
|
||||
vec![Permission::UnlimitedRequests, Permission::UnlimitedUploads],
|
||||
)
|
||||
.await;
|
||||
test.insert_account(account);
|
||||
}
|
||||
// Create test users
|
||||
for (name, secret, description, aliases) in [
|
||||
(
|
||||
"jdoe@example.com",
|
||||
"12345 + extra safety",
|
||||
"John Doe",
|
||||
&["john.doe@example.com"][..],
|
||||
),
|
||||
(
|
||||
"jane.smith@example.com",
|
||||
"abcde + extra safety",
|
||||
"Jane Smith",
|
||||
&["jane@example.com"],
|
||||
),
|
||||
(
|
||||
"bill@example.com",
|
||||
"098765 + extra safety",
|
||||
"Bill Foobar",
|
||||
&["bill.foobar@example.com"],
|
||||
),
|
||||
(
|
||||
"robert@example.com",
|
||||
"aabbcc + extra safety",
|
||||
"Robert Foobar",
|
||||
&[][..],
|
||||
),
|
||||
] {
|
||||
let account = admin
|
||||
.create_user_account(
|
||||
name,
|
||||
secret,
|
||||
description,
|
||||
aliases,
|
||||
vec![Permission::UnlimitedRequests, Permission::UnlimitedUploads],
|
||||
)
|
||||
.await;
|
||||
test.insert_account(account);
|
||||
}
|
||||
|
||||
// Create test group
|
||||
test.insert_account(
|
||||
admin
|
||||
.create_group_account("sales@example.com", "Sales Group", &[])
|
||||
.await,
|
||||
);
|
||||
// Create test group
|
||||
test.insert_account(
|
||||
admin
|
||||
.create_group_account("sales@example.com", "Sales Group", &[])
|
||||
.await,
|
||||
);
|
||||
|
||||
// Add test settings
|
||||
admin
|
||||
.registry_create_object(Imap {
|
||||
allow_plain_text_auth: true,
|
||||
..Default::default()
|
||||
})
|
||||
.await;
|
||||
admin
|
||||
.registry_create_object(Jmap {
|
||||
set_max_objects: 100_000,
|
||||
get_max_results: 100_000,
|
||||
event_source_throttle: 500u64.into(),
|
||||
push_throttle: 500u64.into(),
|
||||
websocket_throttle: 500u64.into(),
|
||||
push_attempt_wait: 500u64.into(),
|
||||
..Default::default()
|
||||
})
|
||||
.await;
|
||||
admin
|
||||
.registry_create_object(MtaStageAuth {
|
||||
require: Expression {
|
||||
else_: "false".to_string(),
|
||||
..Default::default()
|
||||
// Add test settings
|
||||
admin
|
||||
.registry_create_object(Imap {
|
||||
allow_plain_text_auth: true,
|
||||
..Default::default()
|
||||
})
|
||||
.await;
|
||||
admin
|
||||
.registry_create_object(Jmap {
|
||||
set_max_objects: 100_000,
|
||||
get_max_results: 100_000,
|
||||
event_source_throttle: 500u64.into(),
|
||||
push_throttle: 500u64.into(),
|
||||
websocket_throttle: 500u64.into(),
|
||||
push_attempt_wait: 500u64.into(),
|
||||
..Default::default()
|
||||
})
|
||||
.await;
|
||||
admin
|
||||
.registry_create_object(MtaStageAuth {
|
||||
require: Expression {
|
||||
else_: "false".to_string(),
|
||||
..Default::default()
|
||||
},
|
||||
..Default::default()
|
||||
})
|
||||
.await;
|
||||
admin
|
||||
.registry_create_object(CalendarAlarm {
|
||||
min_trigger_interval: 1000u64.into(),
|
||||
..Default::default()
|
||||
})
|
||||
.await;
|
||||
admin
|
||||
.registry_create_object(Sharing {
|
||||
allow_directory_queries: true,
|
||||
..Default::default()
|
||||
})
|
||||
.await;
|
||||
admin
|
||||
.registry_create_object(MtaOutboundStrategy {
|
||||
route: Expression {
|
||||
match_: List::from_iter([
|
||||
ExpressionMatch {
|
||||
if_: "rcpt_domain == 'example.com'".into(),
|
||||
then: "'local'".into(),
|
||||
},
|
||||
..Default::default()
|
||||
})
|
||||
.await;
|
||||
admin
|
||||
.registry_create_object(CalendarAlarm {
|
||||
min_trigger_interval: 1000u64.into(),
|
||||
..Default::default()
|
||||
})
|
||||
.await;
|
||||
admin
|
||||
.registry_create_object(Sharing {
|
||||
allow_directory_queries: true,
|
||||
..Default::default()
|
||||
})
|
||||
.await;
|
||||
admin
|
||||
.registry_create_object(MtaOutboundStrategy {
|
||||
route: Expression {
|
||||
match_: List::from_iter([
|
||||
ExpressionMatch {
|
||||
if_: "rcpt_domain == 'example.com'".into(),
|
||||
then: "'local'".into(),
|
||||
},
|
||||
ExpressionMatch {
|
||||
if_: concat!(
|
||||
"contains(['remote.org', 'foobar.com', ",
|
||||
"'test.com', 'other_domain.com'], rcpt_domain)"
|
||||
)
|
||||
.into(),
|
||||
then: "'mock-smtp'".into(),
|
||||
},
|
||||
]),
|
||||
else_: "'mx'".to_string(),
|
||||
ExpressionMatch {
|
||||
if_: concat!(
|
||||
"contains(['remote.org', 'foobar.com', ",
|
||||
"'test.com', 'other_domain.com'], rcpt_domain)"
|
||||
)
|
||||
.into(),
|
||||
then: "'mock-smtp'".into(),
|
||||
},
|
||||
..Default::default()
|
||||
})
|
||||
.await;
|
||||
admin
|
||||
.registry_create_object(MtaRoute::Relay(MtaRouteRelay {
|
||||
address: "127.0.0.1".into(),
|
||||
port: 9999,
|
||||
allow_invalid_certs: true,
|
||||
implicit_tls: false,
|
||||
name: "mock-smtp".into(),
|
||||
protocol: MtaProtocol::Smtp,
|
||||
..Default::default()
|
||||
}))
|
||||
.await;
|
||||
admin
|
||||
.registry_create_object(MtaExtensions {
|
||||
future_release: Expression {
|
||||
match_: List::from_iter([ExpressionMatch {
|
||||
if_: "!is_empty(authenticated_as)".into(),
|
||||
then: "99999999d".into(),
|
||||
}]),
|
||||
else_: "false".to_string(),
|
||||
},
|
||||
..Default::default()
|
||||
})
|
||||
.await;
|
||||
admin.reload_settings().await;
|
||||
]),
|
||||
else_: "'mx'".to_string(),
|
||||
},
|
||||
..Default::default()
|
||||
})
|
||||
.await;
|
||||
admin
|
||||
.registry_create_object(MtaRoute::Relay(MtaRouteRelay {
|
||||
address: "127.0.0.1".into(),
|
||||
port: 9999,
|
||||
allow_invalid_certs: true,
|
||||
implicit_tls: false,
|
||||
name: "mock-smtp".into(),
|
||||
protocol: MtaProtocol::Smtp,
|
||||
..Default::default()
|
||||
}))
|
||||
.await;
|
||||
admin
|
||||
.registry_create_object(MtaExtensions {
|
||||
future_release: Expression {
|
||||
match_: List::from_iter([ExpressionMatch {
|
||||
if_: "!is_empty(authenticated_as)".into(),
|
||||
then: "99999999d".into(),
|
||||
}]),
|
||||
else_: "false".to_string(),
|
||||
},
|
||||
..Default::default()
|
||||
})
|
||||
.await;
|
||||
admin.reload_settings().await;
|
||||
|
||||
test.insert_account(admin);
|
||||
test.insert_account(admin);
|
||||
|
||||
/*mail::get::test(&test).await;
|
||||
mail::set::test(&test).await;
|
||||
mail::parse::test(&test).await;
|
||||
mail::query::test(&test).await;
|
||||
mail::search_snippet::test(&test).await;
|
||||
mail::changes::test(&test).await;
|
||||
mail::query_changes::test(&test).await;
|
||||
mail::copy::test(&test).await;
|
||||
mail::thread_get::test(&test).await;*/
|
||||
mail::thread_merge::test(&test).await;
|
||||
mail::mailbox::test(&test).await;
|
||||
mail::acl::test(&test).await;
|
||||
mail::sieve_script::test(&test).await;
|
||||
mail::vacation_response::test(&test).await;
|
||||
mail::submission::test(&test).await;
|
||||
mail::get::test(&test).await;
|
||||
mail::set::test(&test).await;
|
||||
mail::parse::test(&test).await;
|
||||
mail::query::test(&test).await;
|
||||
mail::search_snippet::test(&test).await;
|
||||
mail::changes::test(&test).await;
|
||||
mail::query_changes::test(&test).await;
|
||||
mail::copy::test(&test).await;
|
||||
mail::thread_get::test(&test).await;
|
||||
mail::thread_merge::test(&test).await;
|
||||
mail::mailbox::test(&test).await;
|
||||
mail::acl::test(&test).await;
|
||||
mail::sieve_script::test(&test).await;
|
||||
mail::vacation_response::test(&test).await;
|
||||
mail::submission::test(&test).await;
|
||||
|
||||
core::event_source::test(&test).await;
|
||||
core::websocket::test(&test).await;
|
||||
core::push_subscription::test(&test).await;
|
||||
core::blob::test(&test).await;
|
||||
core::event_source::test(&test).await;
|
||||
core::websocket::test(&test).await;
|
||||
core::push_subscription::test(&test).await;
|
||||
core::blob::test(&test).await;
|
||||
|
||||
contacts::addressbook::test(&test).await;
|
||||
contacts::contact::test(&test).await;
|
||||
contacts::acl::test(&test).await;
|
||||
contacts::addressbook::test(&test).await;
|
||||
contacts::contact::test(&test).await;
|
||||
contacts::acl::test(&test).await;
|
||||
|
||||
files::node::test(&test).await;
|
||||
files::acl::test(&test).await;
|
||||
files::node::test(&test).await;
|
||||
files::acl::test(&test).await;
|
||||
|
||||
calendar::calendars::test(&test).await;
|
||||
calendar::event::test(&test).await;
|
||||
calendar::notification::test(&test).await;
|
||||
calendar::alarm::test(&test).await;
|
||||
calendar::calendars::test(&test).await;
|
||||
calendar::event::test(&test).await;
|
||||
calendar::notification::test(&test).await;
|
||||
calendar::alarm::test(&test).await;
|
||||
|
||||
calendar::identity::test(&test).await;
|
||||
calendar::acl::test(&test).await;
|
||||
calendar::identity::test(&test).await;
|
||||
calendar::acl::test(&test).await;
|
||||
|
||||
principal::get::test(&test).await;
|
||||
principal::availability::test(&test).await;
|
||||
principal::get::test(&test).await;
|
||||
principal::availability::test(&test).await;
|
||||
|
||||
if test.is_reset() {
|
||||
test.temp_dir.delete();
|
||||
}
|
||||
});
|
||||
if test.is_reset() {
|
||||
test.temp_dir.delete();
|
||||
}
|
||||
}
|
||||
|
||||
pub fn find_values(string: &str, name: &str) -> Vec<String> {
|
||||
|
||||
Reference in New Issue
Block a user