JMAP tests reorganization
This commit is contained in:
@@ -4,16 +4,10 @@
|
||||
* SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-SEL
|
||||
*/
|
||||
|
||||
use std::{
|
||||
net::{IpAddr, Ipv4Addr},
|
||||
sync::Arc,
|
||||
time::Duration,
|
||||
};
|
||||
|
||||
use crate::{
|
||||
directory::internal::TestInternalDirectory,
|
||||
imap::{ImapConnection, Type},
|
||||
jmap::{assert_is_empty, mailbox::destroy_all_mailboxes},
|
||||
jmap::{JMAPTest, assert_is_empty, mail::mailbox::destroy_all_mailboxes},
|
||||
};
|
||||
use common::listener::blocked::BLOCKED_IP_KEY;
|
||||
use imap_proto::ResponseType;
|
||||
@@ -22,11 +16,14 @@ use jmap_client::{
|
||||
core::set::{SetError, SetErrorType},
|
||||
mailbox::{self},
|
||||
};
|
||||
use std::{
|
||||
net::{IpAddr, Ipv4Addr},
|
||||
sync::Arc,
|
||||
time::Duration,
|
||||
};
|
||||
use store::write::now;
|
||||
use types::id::Id;
|
||||
|
||||
use super::JMAPTest;
|
||||
|
||||
pub async fn test(params: &mut JMAPTest) {
|
||||
println!("Running Authorization tests...");
|
||||
|
||||
@@ -162,7 +159,7 @@ pub async fn test(params: &mut JMAPTest) {
|
||||
assert_eq!(client.session().username(), "jdoe@example.com");
|
||||
assert_eq!(
|
||||
client.session().account(&account_id).unwrap().name(),
|
||||
"John Doe"
|
||||
"jdoe@example.com"
|
||||
);
|
||||
assert!(client.session().account(&account_id).unwrap().is_personal());
|
||||
|
||||
10
tests/src/jmap/auth/mod.rs
Normal file
10
tests/src/jmap/auth/mod.rs
Normal file
@@ -0,0 +1,10 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2020 Stalwart Labs LLC <hello@stalw.art>
|
||||
*
|
||||
* SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-SEL
|
||||
*/
|
||||
|
||||
pub mod limits;
|
||||
pub mod oauth;
|
||||
pub mod permissions;
|
||||
pub mod quota;
|
||||
@@ -4,7 +4,6 @@
|
||||
* SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-SEL
|
||||
*/
|
||||
|
||||
use super::JMAPTest;
|
||||
use crate::{
|
||||
directory::internal::TestInternalDirectory,
|
||||
imap::{
|
||||
@@ -12,7 +11,8 @@ use crate::{
|
||||
pop::{self, Pop3Connection},
|
||||
},
|
||||
jmap::{
|
||||
ManagementApi, assert_is_empty, delivery::SmtpConnection, mailbox::destroy_all_mailboxes,
|
||||
JMAPTest, ManagementApi, assert_is_empty,
|
||||
mail::{delivery::SmtpConnection, mailbox::destroy_all_mailboxes},
|
||||
},
|
||||
};
|
||||
use base64::{Engine, engine::general_purpose};
|
||||
@@ -4,8 +4,7 @@
|
||||
* SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-SEL
|
||||
*/
|
||||
|
||||
use super::{JMAPTest, ManagementApi, enterprise::List};
|
||||
use crate::jmap::assert_is_empty;
|
||||
use crate::jmap::{JMAPTest, ManagementApi, assert_is_empty, server::List};
|
||||
use ahash::AHashSet;
|
||||
use common::auth::{AccessToken, TenantInfo};
|
||||
use directory::{
|
||||
@@ -4,12 +4,12 @@
|
||||
* SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-SEL
|
||||
*/
|
||||
|
||||
use super::JMAPTest;
|
||||
use crate::{
|
||||
directory::internal::TestInternalDirectory,
|
||||
jmap::{
|
||||
assert_is_empty, delivery::SmtpConnection, emails_purge_tombstoned, jmap_raw_request,
|
||||
mailbox::destroy_all_mailboxes, test_account_login,
|
||||
JMAPTest, assert_is_empty, emails_purge_tombstoned, jmap_raw_request,
|
||||
mail::{delivery::SmtpConnection, mailbox::destroy_all_mailboxes},
|
||||
test_account_login,
|
||||
},
|
||||
smtp::queue::QueuedEvents,
|
||||
};
|
||||
@@ -155,6 +155,7 @@ pub async fn test(params: &mut JMAPTest) {
|
||||
.take_id(),
|
||||
);
|
||||
}
|
||||
|
||||
assert_over_quota(
|
||||
client
|
||||
.email_import(
|
||||
7
tests/src/jmap/calendar/mod.rs
Normal file
7
tests/src/jmap/calendar/mod.rs
Normal file
@@ -0,0 +1,7 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2020 Stalwart Labs LLC <hello@stalw.art>
|
||||
*
|
||||
* SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-SEL
|
||||
*/
|
||||
|
||||
|
||||
7
tests/src/jmap/contacts/mod.rs
Normal file
7
tests/src/jmap/contacts/mod.rs
Normal file
@@ -0,0 +1,7 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2020 Stalwart Labs LLC <hello@stalw.art>
|
||||
*
|
||||
* SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-SEL
|
||||
*/
|
||||
|
||||
|
||||
@@ -4,10 +4,9 @@
|
||||
* SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-SEL
|
||||
*/
|
||||
|
||||
use super::JMAPTest;
|
||||
use crate::{
|
||||
directory::internal::TestInternalDirectory,
|
||||
jmap::{assert_is_empty, jmap_json_request, mailbox::destroy_all_mailboxes},
|
||||
jmap::{JMAPTest, assert_is_empty, jmap_json_request, mail::mailbox::destroy_all_mailboxes},
|
||||
};
|
||||
use email::mailbox::INBOX_ID;
|
||||
use serde_json::Value;
|
||||
@@ -9,7 +9,8 @@ use std::time::Duration;
|
||||
use crate::{
|
||||
directory::internal::TestInternalDirectory,
|
||||
jmap::{
|
||||
assert_is_empty, delivery::SmtpConnection, mailbox::destroy_all_mailboxes,
|
||||
JMAPTest, assert_is_empty,
|
||||
mail::{delivery::SmtpConnection, mailbox::destroy_all_mailboxes},
|
||||
test_account_login,
|
||||
},
|
||||
};
|
||||
@@ -17,13 +18,11 @@ use email::mailbox::INBOX_ID;
|
||||
use futures::StreamExt;
|
||||
|
||||
use jmap_client::{TypeState, event_source::Changes, mailbox::Role};
|
||||
use types::id::Id;
|
||||
use store::ahash::AHashSet;
|
||||
use types::id::Id;
|
||||
|
||||
use tokio::sync::mpsc;
|
||||
|
||||
use super::JMAPTest;
|
||||
|
||||
pub async fn test(params: &mut JMAPTest) {
|
||||
println!("Running EventSource tests...");
|
||||
|
||||
10
tests/src/jmap/core/mod.rs
Normal file
10
tests/src/jmap/core/mod.rs
Normal file
@@ -0,0 +1,10 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2020 Stalwart Labs LLC <hello@stalw.art>
|
||||
*
|
||||
* SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-SEL
|
||||
*/
|
||||
|
||||
pub mod blob;
|
||||
pub mod event_source;
|
||||
pub mod push_subscription;
|
||||
pub mod websocket;
|
||||
@@ -4,11 +4,10 @@
|
||||
* SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-SEL
|
||||
*/
|
||||
|
||||
use super::JMAPTest;
|
||||
use crate::{
|
||||
AssertConfig, add_test_certs,
|
||||
directory::internal::TestInternalDirectory,
|
||||
jmap::{assert_is_empty, mailbox::destroy_all_mailboxes, test_account_login},
|
||||
jmap::{JMAPTest, assert_is_empty, mail::mailbox::destroy_all_mailboxes, test_account_login},
|
||||
};
|
||||
use base64::{Engine, engine::general_purpose};
|
||||
use common::{Caches, Core, Data, Inner, config::server::Listeners, listener::SessionData};
|
||||
@@ -21,11 +21,9 @@ use tokio::sync::mpsc;
|
||||
|
||||
use crate::{
|
||||
directory::internal::TestInternalDirectory,
|
||||
jmap::{assert_is_empty, mailbox::destroy_all_mailboxes, test_account_login},
|
||||
jmap::{JMAPTest, assert_is_empty, mail::mailbox::destroy_all_mailboxes, test_account_login},
|
||||
};
|
||||
|
||||
use super::JMAPTest;
|
||||
|
||||
pub async fn test(params: &mut JMAPTest) {
|
||||
println!("Running WebSockets tests...");
|
||||
let server = params.server.clone();
|
||||
5
tests/src/jmap/files/mod.rs
Normal file
5
tests/src/jmap/files/mod.rs
Normal file
@@ -0,0 +1,5 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2020 Stalwart Labs LLC <hello@stalw.art>
|
||||
*
|
||||
* SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-SEL
|
||||
*/
|
||||
@@ -6,7 +6,7 @@
|
||||
|
||||
use crate::{
|
||||
directory::internal::TestInternalDirectory,
|
||||
jmap::{assert_is_empty, mailbox::destroy_all_mailboxes, test_account_login},
|
||||
jmap::{JMAPTest, assert_is_empty, mail::mailbox::destroy_all_mailboxes, test_account_login},
|
||||
};
|
||||
use ::email::mailbox::{INBOX_ID, TRASH_ID};
|
||||
use jmap_client::{
|
||||
@@ -22,8 +22,6 @@ use std::fmt::Debug;
|
||||
use store::ahash::AHashMap;
|
||||
use types::id::Id;
|
||||
|
||||
use super::JMAPTest;
|
||||
|
||||
pub async fn test(params: &mut JMAPTest) {
|
||||
println!("Running ACL tests...");
|
||||
let server = params.server.clone();
|
||||
@@ -4,11 +4,9 @@
|
||||
* SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-SEL
|
||||
*/
|
||||
|
||||
use std::str::FromStr;
|
||||
|
||||
use super::JMAPTest;
|
||||
use crate::jmap::assert_is_empty;
|
||||
use crate::jmap::{JMAPTest, assert_is_empty};
|
||||
use jmap_proto::types::state::State;
|
||||
use std::str::FromStr;
|
||||
use store::{ahash::AHashSet, write::BatchBuilder};
|
||||
use types::{
|
||||
collection::{Collection, SyncCollection},
|
||||
@@ -4,8 +4,7 @@
|
||||
* SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-SEL
|
||||
*/
|
||||
|
||||
use super::JMAPTest;
|
||||
use crate::jmap::{assert_is_empty, mailbox::destroy_all_mailboxes};
|
||||
use crate::jmap::{JMAPTest, assert_is_empty, mail::mailbox::destroy_all_mailboxes};
|
||||
use jmap_client::mailbox::Role;
|
||||
use types::id::Id;
|
||||
|
||||
@@ -4,10 +4,9 @@
|
||||
* SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-SEL
|
||||
*/
|
||||
|
||||
use super::JMAPTest;
|
||||
use crate::{
|
||||
directory::internal::TestInternalDirectory,
|
||||
jmap::{ManagementApi, delivery::SmtpConnection},
|
||||
jmap::{JMAPTest, ManagementApi, mail::delivery::SmtpConnection},
|
||||
};
|
||||
use email::message::crypto::{
|
||||
Algorithm, EncryptMessage, EncryptionMethod, EncryptionParams, EncryptionType, try_parse_certs,
|
||||
@@ -4,10 +4,9 @@
|
||||
* SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-SEL
|
||||
*/
|
||||
|
||||
use super::JMAPTest;
|
||||
use crate::{
|
||||
directory::internal::TestInternalDirectory,
|
||||
jmap::{assert_is_empty, mailbox::destroy_all_mailboxes},
|
||||
jmap::{JMAPTest, assert_is_empty, mail::mailbox::destroy_all_mailboxes},
|
||||
webdav::DummyWebDavClient,
|
||||
};
|
||||
use email::{
|
||||
@@ -4,8 +4,9 @@
|
||||
* SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-SEL
|
||||
*/
|
||||
|
||||
use super::JMAPTest;
|
||||
use crate::jmap::{assert_is_empty, mailbox::destroy_all_mailboxes, replace_blob_ids};
|
||||
use crate::jmap::{
|
||||
JMAPTest, assert_is_empty, mail::mailbox::destroy_all_mailboxes, replace_blob_ids,
|
||||
};
|
||||
use ::email::mailbox::INBOX_ID;
|
||||
use jmap_client::email::{self, Header, HeaderForm, import::EmailImportResponse};
|
||||
use mail_parser::HeaderName;
|
||||
@@ -4,8 +4,7 @@
|
||||
* SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-SEL
|
||||
*/
|
||||
|
||||
use std::time::Duration;
|
||||
|
||||
use crate::jmap::{JMAPTest, assert_is_empty, wait_for_index};
|
||||
use jmap_client::{
|
||||
Error, Set,
|
||||
client::{Client, Credentials},
|
||||
@@ -17,13 +16,10 @@ use jmap_client::{
|
||||
};
|
||||
use jmap_proto::types::state::State;
|
||||
use serde::{Deserialize, Serialize};
|
||||
use std::time::Duration;
|
||||
use store::ahash::AHashMap;
|
||||
use types::id::Id;
|
||||
|
||||
use crate::jmap::assert_is_empty;
|
||||
|
||||
use super::{JMAPTest, wait_for_index};
|
||||
|
||||
pub async fn test(params: &mut JMAPTest) {
|
||||
println!("Running Mailbox tests...");
|
||||
let server = params.server.clone();
|
||||
23
tests/src/jmap/mail/mod.rs
Normal file
23
tests/src/jmap/mail/mod.rs
Normal file
@@ -0,0 +1,23 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2020 Stalwart Labs LLC <hello@stalw.art>
|
||||
*
|
||||
* SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-SEL
|
||||
*/
|
||||
|
||||
pub mod acl;
|
||||
pub mod changes;
|
||||
pub mod copy;
|
||||
pub mod crypto;
|
||||
pub mod delivery;
|
||||
pub mod get;
|
||||
pub mod mailbox;
|
||||
pub mod parse;
|
||||
pub mod query;
|
||||
pub mod query_changes;
|
||||
pub mod search_snippet;
|
||||
pub mod set;
|
||||
pub mod sieve_script;
|
||||
pub mod submission;
|
||||
pub mod thread_get;
|
||||
pub mod thread_merge;
|
||||
pub mod vacation_response;
|
||||
@@ -4,9 +4,10 @@
|
||||
* SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-SEL
|
||||
*/
|
||||
|
||||
use super::JMAPTest;
|
||||
use crate::jmap::{
|
||||
assert_is_empty, email_get::all_headers, mailbox::destroy_all_mailboxes, replace_blob_ids,
|
||||
JMAPTest, assert_is_empty,
|
||||
mail::{get::all_headers, mailbox::destroy_all_mailboxes},
|
||||
replace_blob_ids,
|
||||
};
|
||||
use jmap_client::{
|
||||
email::{self, Header, HeaderForm},
|
||||
@@ -4,9 +4,8 @@
|
||||
* SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-SEL
|
||||
*/
|
||||
|
||||
use super::JMAPTest;
|
||||
use crate::{
|
||||
jmap::{assert_is_empty, mailbox::destroy_all_mailboxes, wait_for_index},
|
||||
jmap::{JMAPTest, assert_is_empty, mail::mailbox::destroy_all_mailboxes, wait_for_index},
|
||||
store::{deflate_test_resource, query::FIELDS},
|
||||
};
|
||||
use ::email::{cache::MessageCacheFetch, mailbox::Mailbox};
|
||||
@@ -4,13 +4,12 @@
|
||||
* SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-SEL
|
||||
*/
|
||||
|
||||
use std::str::FromStr;
|
||||
|
||||
use super::JMAPTest;
|
||||
use crate::jmap::{
|
||||
assert_is_empty,
|
||||
email_changes::{LogAction, ParseState},
|
||||
mailbox::destroy_all_mailboxes,
|
||||
JMAPTest, assert_is_empty,
|
||||
mail::{
|
||||
changes::{LogAction, ParseState},
|
||||
mailbox::destroy_all_mailboxes,
|
||||
},
|
||||
};
|
||||
use ::email::message::metadata::MessageData;
|
||||
use common::storage::index::ObjectIndexBuilder;
|
||||
@@ -20,6 +19,7 @@ use jmap_client::{
|
||||
mailbox::Role,
|
||||
};
|
||||
use jmap_proto::types::state::State;
|
||||
use std::str::FromStr;
|
||||
use store::{
|
||||
ahash::{AHashMap, AHashSet},
|
||||
write::BatchBuilder,
|
||||
@@ -4,15 +4,15 @@
|
||||
* SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-SEL
|
||||
*/
|
||||
|
||||
use crate::jmap::{assert_is_empty, mailbox::destroy_all_mailboxes, wait_for_index};
|
||||
use crate::jmap::{
|
||||
JMAPTest, assert_is_empty, mail::mailbox::destroy_all_mailboxes, wait_for_index,
|
||||
};
|
||||
use email::mailbox::INBOX_ID;
|
||||
use jmap_client::{core::query, email::query::Filter};
|
||||
use std::{fs, path::PathBuf};
|
||||
use store::ahash::AHashMap;
|
||||
use types::id::Id;
|
||||
|
||||
use super::JMAPTest;
|
||||
|
||||
pub async fn test(params: &mut JMAPTest) {
|
||||
println!("Running SearchSnippet tests...");
|
||||
let server = params.server.clone();
|
||||
@@ -4,9 +4,10 @@
|
||||
* SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-SEL
|
||||
*/
|
||||
|
||||
use std::{fs, path::PathBuf};
|
||||
|
||||
use crate::jmap::{assert_is_empty, mailbox::destroy_all_mailboxes};
|
||||
use crate::jmap::{
|
||||
JMAPTest, assert_is_empty, find_values, mail::mailbox::destroy_all_mailboxes, replace_blob_ids,
|
||||
replace_boundaries, replace_values,
|
||||
};
|
||||
use ::email::mailbox::INBOX_ID;
|
||||
use ahash::AHashSet;
|
||||
use jmap_client::{
|
||||
@@ -16,10 +17,9 @@ use jmap_client::{
|
||||
email::{self, Email},
|
||||
mailbox::Role,
|
||||
};
|
||||
use std::{fs, path::PathBuf};
|
||||
use types::id::Id;
|
||||
|
||||
use super::{JMAPTest, find_values, replace_blob_ids, replace_boundaries, replace_values};
|
||||
|
||||
pub async fn test(params: &mut JMAPTest) {
|
||||
println!("Running Email Set tests...");
|
||||
let server = params.server.clone();
|
||||
@@ -4,31 +4,30 @@
|
||||
* SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-SEL
|
||||
*/
|
||||
|
||||
use crate::{
|
||||
directory::internal::TestInternalDirectory,
|
||||
jmap::{
|
||||
JMAPTest, assert_is_empty,
|
||||
mail::{
|
||||
delivery::SmtpConnection,
|
||||
mailbox::destroy_all_mailboxes,
|
||||
submission::{MockMessage, assert_message_delivery, spawn_mock_smtp_server},
|
||||
},
|
||||
},
|
||||
smtp::DnsCache,
|
||||
};
|
||||
use jmap_client::{
|
||||
Error,
|
||||
core::set::{SetError, SetErrorType},
|
||||
email, mailbox,
|
||||
sieve::query::{Comparator, Filter},
|
||||
};
|
||||
use types::id::Id;
|
||||
use std::{
|
||||
fs,
|
||||
path::PathBuf,
|
||||
time::{Duration, Instant},
|
||||
};
|
||||
|
||||
use crate::{
|
||||
directory::internal::TestInternalDirectory,
|
||||
jmap::{
|
||||
assert_is_empty,
|
||||
delivery::SmtpConnection,
|
||||
email_submission::{MockMessage, assert_message_delivery, spawn_mock_smtp_server},
|
||||
mailbox::destroy_all_mailboxes,
|
||||
},
|
||||
smtp::DnsCache,
|
||||
};
|
||||
|
||||
use super::JMAPTest;
|
||||
use types::id::Id;
|
||||
|
||||
pub async fn test(params: &mut JMAPTest) {
|
||||
println!("Running Sieve tests...");
|
||||
@@ -4,6 +4,14 @@
|
||||
* SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-SEL
|
||||
*/
|
||||
|
||||
use crate::{
|
||||
directory::internal::TestInternalDirectory,
|
||||
jmap::{
|
||||
JMAPTest, assert_is_empty,
|
||||
mail::{mailbox::destroy_all_mailboxes, set::assert_email_properties},
|
||||
},
|
||||
smtp::DnsCache,
|
||||
};
|
||||
use ahash::AHashMap;
|
||||
use jmap_client::{
|
||||
Error,
|
||||
@@ -11,27 +19,18 @@ use jmap_client::{
|
||||
email_submission::{Address, Delivered, DeliveryStatus, Displayed, UndoStatus, query::Filter},
|
||||
mailbox::Role,
|
||||
};
|
||||
use types::id::Id;
|
||||
use mail_parser::DateTime;
|
||||
use std::{
|
||||
sync::Arc,
|
||||
time::{Duration, Instant},
|
||||
};
|
||||
use store::parking_lot::Mutex;
|
||||
|
||||
use tokio::{
|
||||
io::{AsyncBufReadExt, AsyncWriteExt, BufReader},
|
||||
net::TcpListener,
|
||||
sync::mpsc,
|
||||
};
|
||||
|
||||
use crate::{
|
||||
directory::internal::TestInternalDirectory,
|
||||
jmap::{assert_is_empty, email_set::assert_email_properties, mailbox::destroy_all_mailboxes},
|
||||
smtp::DnsCache,
|
||||
};
|
||||
|
||||
use super::JMAPTest;
|
||||
use types::id::Id;
|
||||
|
||||
#[derive(Default, Debug, PartialEq, Eq)]
|
||||
pub struct MockMessage {
|
||||
@@ -4,12 +4,10 @@
|
||||
* SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-SEL
|
||||
*/
|
||||
|
||||
use crate::jmap::{assert_is_empty, mailbox::destroy_all_mailboxes};
|
||||
use crate::jmap::{JMAPTest, assert_is_empty, mail::mailbox::destroy_all_mailboxes};
|
||||
use jmap_client::mailbox::Role;
|
||||
use types::id::Id;
|
||||
|
||||
use super::JMAPTest;
|
||||
|
||||
pub async fn test(params: &mut JMAPTest) {
|
||||
println!("Running Email Thread tests...");
|
||||
let server = params.server.clone();
|
||||
@@ -4,9 +4,8 @@
|
||||
* SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-SEL
|
||||
*/
|
||||
|
||||
use super::JMAPTest;
|
||||
use crate::{
|
||||
jmap::{assert_is_empty, mailbox::destroy_all_mailboxes},
|
||||
jmap::{JMAPTest, assert_is_empty, mail::mailbox::destroy_all_mailboxes},
|
||||
store::deflate_test_resource,
|
||||
};
|
||||
use ::email::message::ingest::{EmailIngest, IngestEmail, IngestSource};
|
||||
@@ -4,25 +4,23 @@
|
||||
* SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-SEL
|
||||
*/
|
||||
|
||||
use chrono::{TimeDelta, Utc};
|
||||
|
||||
use std::time::Instant;
|
||||
use types::id::Id;
|
||||
|
||||
use crate::{
|
||||
directory::internal::TestInternalDirectory,
|
||||
jmap::{
|
||||
assert_is_empty,
|
||||
delivery::SmtpConnection,
|
||||
email_submission::{
|
||||
MockMessage, assert_message_delivery, expect_nothing, spawn_mock_smtp_server,
|
||||
JMAPTest, assert_is_empty,
|
||||
mail::{
|
||||
delivery::SmtpConnection,
|
||||
mailbox::destroy_all_mailboxes,
|
||||
submission::{
|
||||
MockMessage, assert_message_delivery, expect_nothing, spawn_mock_smtp_server,
|
||||
},
|
||||
},
|
||||
mailbox::destroy_all_mailboxes,
|
||||
},
|
||||
smtp::DnsCache,
|
||||
};
|
||||
|
||||
use super::JMAPTest;
|
||||
use chrono::{TimeDelta, Utc};
|
||||
use std::time::Instant;
|
||||
use types::id::Id;
|
||||
|
||||
pub async fn test(params: &mut JMAPTest) {
|
||||
println!("Running Vacation Response tests...");
|
||||
@@ -5,7 +5,13 @@
|
||||
*/
|
||||
|
||||
use crate::{
|
||||
AssertConfig, add_test_certs, directory::internal::TestInternalDirectory, store::TempDir,
|
||||
AssertConfig, add_test_certs,
|
||||
directory::internal::TestInternalDirectory,
|
||||
jmap::server::{
|
||||
enterprise::{EnterpriseCore, insert_test_metrics},
|
||||
webhooks::{MockWebhookEndpoint, spawn_mock_webhook_endpoint},
|
||||
},
|
||||
store::TempDir,
|
||||
};
|
||||
use base64::{
|
||||
Engine,
|
||||
@@ -25,7 +31,6 @@ use common::{
|
||||
},
|
||||
};
|
||||
use email::message::delete::EmailDeletion;
|
||||
use enterprise::{EnterpriseCore, insert_test_metrics};
|
||||
use http::HttpSessionManager;
|
||||
use hyper::{Method, header::AUTHORIZATION};
|
||||
use imap::core::ImapSessionManager;
|
||||
@@ -46,36 +51,14 @@ use store::{
|
||||
use tokio::sync::watch;
|
||||
use types::{blob_hash::BlobHash, id::Id};
|
||||
use utils::config::Config;
|
||||
use webhooks::{MockWebhookEndpoint, spawn_mock_webhook_endpoint};
|
||||
|
||||
pub mod auth_acl;
|
||||
pub mod auth_limits;
|
||||
pub mod auth_oauth;
|
||||
pub mod blob;
|
||||
pub mod crypto;
|
||||
pub mod delivery;
|
||||
pub mod email_changes;
|
||||
pub mod email_copy;
|
||||
pub mod email_get;
|
||||
pub mod email_parse;
|
||||
pub mod email_query;
|
||||
pub mod email_query_changes;
|
||||
pub mod email_search_snippet;
|
||||
pub mod email_set;
|
||||
pub mod email_submission;
|
||||
pub mod enterprise;
|
||||
pub mod event_source;
|
||||
pub mod mailbox;
|
||||
pub mod permissions;
|
||||
pub mod purge;
|
||||
pub mod push_subscription;
|
||||
pub mod quota;
|
||||
pub mod sieve_script;
|
||||
pub mod thread_get;
|
||||
pub mod thread_merge;
|
||||
pub mod vacation_response;
|
||||
pub mod webhooks;
|
||||
pub mod websocket;
|
||||
pub mod auth;
|
||||
pub mod calendar;
|
||||
pub mod contacts;
|
||||
pub mod core;
|
||||
pub mod files;
|
||||
pub mod mail;
|
||||
pub mod server;
|
||||
|
||||
#[tokio::test(flavor = "multi_thread")]
|
||||
async fn jmap_tests() {
|
||||
@@ -87,34 +70,34 @@ async fn jmap_tests() {
|
||||
)
|
||||
.await;
|
||||
|
||||
webhooks::test(&mut params).await;
|
||||
/*email_query::test(&mut params, delete).await;
|
||||
email_get::test(&mut params).await;
|
||||
email_set::test(&mut params).await;
|
||||
email_parse::test(&mut params).await;
|
||||
email_search_snippet::test(&mut params).await;
|
||||
email_changes::test(&mut params).await;
|
||||
email_query_changes::test(&mut params).await;
|
||||
email_copy::test(&mut params).await;
|
||||
thread_get::test(&mut params).await;
|
||||
thread_merge::test(&mut params).await;
|
||||
mailbox::test(&mut params).await;*/
|
||||
delivery::test(&mut params).await;
|
||||
auth_acl::test(&mut params).await;
|
||||
auth_limits::test(&mut params).await;
|
||||
auth_oauth::test(&mut params).await;
|
||||
event_source::test(&mut params).await;
|
||||
push_subscription::test(&mut params).await;
|
||||
sieve_script::test(&mut params).await;
|
||||
vacation_response::test(&mut params).await;
|
||||
email_submission::test(&mut params).await;
|
||||
websocket::test(&mut params).await;
|
||||
quota::test(&mut params).await;
|
||||
crypto::test(&mut params).await;
|
||||
blob::test(&mut params).await;
|
||||
permissions::test(¶ms).await;
|
||||
purge::test(&mut params).await;
|
||||
enterprise::test(&mut params).await;
|
||||
server::webhooks::test(&mut params).await;
|
||||
/*mail::query::test(&mut params, delete).await;
|
||||
mail::get::test(&mut params).await;
|
||||
mail::set::test(&mut params).await;
|
||||
mail::parse::test(&mut params).await;
|
||||
mail::search_snippet::test(&mut params).await;
|
||||
mail::changes::test(&mut params).await;
|
||||
mail::query_changes::test(&mut params).await;
|
||||
mail::copy::test(&mut params).await;
|
||||
mail::thread_get::test(&mut params).await;
|
||||
mail::thread_merge::test(&mut params).await;
|
||||
mail::mailbox::test(&mut params).await;
|
||||
mail::delivery::test(&mut params).await;
|
||||
mail::acl::test(&mut params).await;*/
|
||||
auth::limits::test(&mut params).await;
|
||||
auth::oauth::test(&mut params).await;
|
||||
core::event_source::test(&mut params).await;
|
||||
core::push_subscription::test(&mut params).await;
|
||||
mail::sieve_script::test(&mut params).await;
|
||||
mail::vacation_response::test(&mut params).await;
|
||||
mail::submission::test(&mut params).await;
|
||||
core::websocket::test(&mut params).await;
|
||||
auth::quota::test(&mut params).await;
|
||||
mail::crypto::test(&mut params).await;
|
||||
core::blob::test(&mut params).await;
|
||||
auth::permissions::test(¶ms).await;
|
||||
server::purge::test(&mut params).await;
|
||||
server::enterprise::test(&mut params).await;
|
||||
|
||||
if delete {
|
||||
params.temp_dir.delete();
|
||||
|
||||
@@ -8,8 +8,16 @@
|
||||
*
|
||||
*/
|
||||
|
||||
use std::{sync::Arc, time::Duration};
|
||||
|
||||
use crate::{
|
||||
AssertConfig,
|
||||
directory::internal::TestInternalDirectory,
|
||||
imap::{ImapConnection, Type},
|
||||
jmap::{
|
||||
JMAPTest, ManagementApi,
|
||||
mail::delivery::{AssertResult, SmtpConnection},
|
||||
server::List,
|
||||
},
|
||||
};
|
||||
use common::{
|
||||
Core, Server,
|
||||
config::telemetry::{StoreTracer, TelemetrySubscriberType},
|
||||
@@ -25,6 +33,7 @@ use common::{
|
||||
};
|
||||
use http::management::enterprise::undelete::{UndeleteRequest, UndeleteResponse};
|
||||
use imap_proto::ResponseType;
|
||||
use std::{sync::Arc, time::Duration};
|
||||
use store::{
|
||||
rand::{self, Rng},
|
||||
write::now,
|
||||
@@ -35,15 +44,6 @@ use trc::{
|
||||
};
|
||||
use utils::config::{Config, cron::SimpleCron};
|
||||
|
||||
use crate::{
|
||||
AssertConfig,
|
||||
directory::internal::TestInternalDirectory,
|
||||
imap::{ImapConnection, Type},
|
||||
jmap::delivery::SmtpConnection,
|
||||
};
|
||||
|
||||
use super::{JMAPTest, ManagementApi, delivery::AssertResult};
|
||||
|
||||
const METRICS_CONFIG: &str = r#"
|
||||
[metrics.alerts.expected]
|
||||
enable = true
|
||||
@@ -509,10 +509,3 @@ pub async fn insert_test_metrics(core: Arc<Core>) {
|
||||
start_time += 60 * 60;
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(serde::Deserialize, Debug)]
|
||||
#[allow(dead_code)]
|
||||
pub(super) struct List<T> {
|
||||
pub items: Vec<T>,
|
||||
pub total: usize,
|
||||
}
|
||||
16
tests/src/jmap/server/mod.rs
Normal file
16
tests/src/jmap/server/mod.rs
Normal file
@@ -0,0 +1,16 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2020 Stalwart Labs LLC <hello@stalw.art>
|
||||
*
|
||||
* SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-SEL
|
||||
*/
|
||||
|
||||
pub mod enterprise;
|
||||
pub mod purge;
|
||||
pub mod webhooks;
|
||||
|
||||
#[derive(serde::Deserialize, Debug)]
|
||||
#[allow(dead_code)]
|
||||
pub(crate) struct List<T> {
|
||||
pub items: Vec<T>,
|
||||
pub total: usize,
|
||||
}
|
||||
@@ -4,11 +4,10 @@
|
||||
* SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-SEL
|
||||
*/
|
||||
|
||||
use super::JMAPTest;
|
||||
use crate::{
|
||||
directory::internal::TestInternalDirectory,
|
||||
imap::{AssertResult, ImapConnection, Type},
|
||||
jmap::assert_is_empty,
|
||||
jmap::{JMAPTest, assert_is_empty},
|
||||
};
|
||||
use ahash::AHashSet;
|
||||
use common::Server;
|
||||
@@ -12,6 +12,7 @@ use std::{
|
||||
time::Duration,
|
||||
};
|
||||
|
||||
use crate::jmap::JMAPTest;
|
||||
use base64::{Engine, engine::general_purpose::STANDARD};
|
||||
use common::manager::webadmin::Resource;
|
||||
use http_proto::{ToHttpResponse, request::fetch_body};
|
||||
@@ -23,8 +24,6 @@ use ring::hmac;
|
||||
use store::parking_lot::Mutex;
|
||||
use tokio::{net::TcpListener, sync::watch};
|
||||
|
||||
use super::JMAPTest;
|
||||
|
||||
pub struct MockWebhookEndpoint {
|
||||
pub tx: watch::Sender<bool>,
|
||||
pub events: Mutex<Vec<serde_json::Value>>,
|
||||
Reference in New Issue
Block a user