mirror of
https://github.com/stalwartlabs/mail-server.git
synced 2025-10-30 06:16:06 +08:00
Added test to jmap-proto.
This commit is contained in:
parent
1ce0cee7e6
commit
e33aa9b393
4 changed files with 102 additions and 1 deletions
1
Cargo.lock
generated
1
Cargo.lock
generated
|
|
@ -1861,6 +1861,7 @@ dependencies = [
|
|||
"serde",
|
||||
"serde_json",
|
||||
"store",
|
||||
"tokio",
|
||||
"tracing",
|
||||
"utils",
|
||||
]
|
||||
|
|
|
|||
|
|
@ -13,3 +13,6 @@ serde = { version = "1.0", features = ["derive"]}
|
|||
ahash = { version = "0.8.0", features = ["serde"] }
|
||||
serde_json = { version = "1.0", features = ["raw_value"] }
|
||||
tracing = "0.1"
|
||||
|
||||
[dev-dependencies]
|
||||
tokio = { version = "1.23", features = ["full"] }
|
||||
|
|
|
|||
|
|
@ -252,8 +252,101 @@ mod tests {
|
|||
}
|
||||
"#;
|
||||
|
||||
const TEST2: &str = r##"
|
||||
{
|
||||
"using": [
|
||||
"urn:ietf:params:jmap:submission",
|
||||
"urn:ietf:params:jmap:mail",
|
||||
"urn:ietf:params:jmap:core"
|
||||
],
|
||||
"methodCalls": [
|
||||
[
|
||||
"Email/set",
|
||||
{
|
||||
"accountId": "c",
|
||||
"create": {
|
||||
"c37ee58b-e224-4799-88e6-1d7484e3b782": {
|
||||
"mailboxIds": {
|
||||
"9": true
|
||||
},
|
||||
"subject": "test",
|
||||
"from": [
|
||||
{
|
||||
"name": "Foo",
|
||||
"email": "foo@bar.com"
|
||||
}
|
||||
],
|
||||
"to": [
|
||||
{
|
||||
"name": null,
|
||||
"email": "bar@foo.com"
|
||||
}
|
||||
],
|
||||
"cc": [],
|
||||
"bcc": [],
|
||||
"replyTo": [
|
||||
{
|
||||
"name": null,
|
||||
"email": "foo@bar.com"
|
||||
}
|
||||
],
|
||||
"htmlBody": [
|
||||
{
|
||||
"partId": "c37ee58b-e224-4799-88e6-1d7484e3b782",
|
||||
"type": "text/html"
|
||||
}
|
||||
],
|
||||
"bodyValues": {
|
||||
"c37ee58b-e224-4799-88e6-1d7484e3b782": {
|
||||
"value": "<p>test email<br></p>",
|
||||
"isEncodingProblem": false,
|
||||
"isTruncated": false
|
||||
}
|
||||
},
|
||||
"header:User-Agent:asText": "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:109.0) Gecko/20100101 Firefox/113.0"
|
||||
}
|
||||
}
|
||||
},
|
||||
"c0"
|
||||
],
|
||||
[
|
||||
"EmailSubmission/set",
|
||||
{
|
||||
"accountId": "c",
|
||||
"create": {
|
||||
"c37ee58b-e224-4799-88e6-1d7484e3b782": {
|
||||
"identityId": "a",
|
||||
"emailId": "#c37ee58b-e224-4799-88e6-1d7484e3b782",
|
||||
"envelope": {
|
||||
"mailFrom": {
|
||||
"email": "foo@bar.com"
|
||||
},
|
||||
"rcptTo": [
|
||||
{
|
||||
"email": "bar@foo.com"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
"onSuccessUpdateEmail": {
|
||||
"#c37ee58b-e224-4799-88e6-1d7484e3b782": {
|
||||
"mailboxIds/d": true,
|
||||
"mailboxIds/9": null,
|
||||
"keywords/$seen": true,
|
||||
"keywords/$draft": null
|
||||
}
|
||||
}
|
||||
},
|
||||
"c1"
|
||||
]
|
||||
]
|
||||
}
|
||||
"##;
|
||||
|
||||
#[test]
|
||||
fn parse_request() {
|
||||
println!("{:?}", Request::parse(TEST.as_bytes(), 10, 1024));
|
||||
println!("{:?}", Request::parse(TEST.as_bytes(), 10, 10240));
|
||||
println!("{:?}", Request::parse(TEST2.as_bytes(), 10, 10240));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -346,6 +346,10 @@ impl ReadTransaction<'_> {
|
|||
unimplemented!("No backend selected")
|
||||
}
|
||||
|
||||
pub(crate) async fn get_quota(&self, _account_id: u32) -> crate::Result<i64> {
|
||||
unimplemented!("No backend selected")
|
||||
}
|
||||
|
||||
pub async fn refresh_if_old(&mut self) -> crate::Result<()> {
|
||||
unimplemented!("No backend selected")
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue