Email get tests.
This commit is contained in:
@@ -5,7 +5,6 @@ use serde::Serialize;
|
||||
use store::BlobKind;
|
||||
|
||||
use crate::{
|
||||
error::method::MethodError,
|
||||
object::Object,
|
||||
parser::{json::Parser, Ignore, JsonObjectParser, Token},
|
||||
request::reference::{MaybeReference, ResultReference},
|
||||
@@ -156,16 +155,6 @@ impl Value {
|
||||
_ => Value::parse::<String, String>(parser),
|
||||
}
|
||||
}
|
||||
|
||||
pub fn as_blob(&self) -> Result<&BlobId, MethodError> {
|
||||
match self {
|
||||
Value::BlobId(blob) => Ok(blob),
|
||||
_ => {
|
||||
let log = "log";
|
||||
Err(MethodError::ServerPartialFail)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl<T: JsonObjectParser + Display + Eq> JsonObjectParser for SetValueMap<T> {
|
||||
|
||||
@@ -1,109 +0,0 @@
|
||||
{
|
||||
"mailboxIds": {
|
||||
"a": true
|
||||
},
|
||||
"keywords": {
|
||||
"tag": true
|
||||
},
|
||||
"size": 2651,
|
||||
"receivedAt": "2054-01-02T20:53:20Z",
|
||||
"from": [
|
||||
{
|
||||
"name": "Al Gore",
|
||||
"email": "vice-president@whitehouse.gov"
|
||||
}
|
||||
],
|
||||
"to": [
|
||||
{
|
||||
"name": "White House Transportation Coordinator",
|
||||
"email": "transport@whitehouse.gov"
|
||||
}
|
||||
],
|
||||
"subject": "[Fwd: Map of Argentina with Description]",
|
||||
"bodyStructure": {
|
||||
"partId": "0",
|
||||
"headers": [
|
||||
{
|
||||
"name": "From",
|
||||
"value": " Al Gore <vice-president@whitehouse.gov>"
|
||||
},
|
||||
{
|
||||
"name": "To",
|
||||
"value": " White House Transportation Coordinator\n <transport@whitehouse.gov>"
|
||||
},
|
||||
{
|
||||
"name": "Subject",
|
||||
"value": " [Fwd: Map of Argentina with Description]"
|
||||
},
|
||||
{
|
||||
"name": "Content-Type",
|
||||
"value": " multipart/mixed;\n boundary=\"D7F------------D7FD5A0B8AB9C65CCDBFA872\""
|
||||
}
|
||||
],
|
||||
"type": "multipart/mixed"
|
||||
},
|
||||
"bodyValues": {},
|
||||
"textBody": [
|
||||
{
|
||||
"partId": "1",
|
||||
"blobId": "blob_0",
|
||||
"size": 61,
|
||||
"headers": [
|
||||
{
|
||||
"name": "Content-Type",
|
||||
"value": " text/plain; charset=us-ascii"
|
||||
},
|
||||
{
|
||||
"name": "Content-Transfer-Encoding",
|
||||
"value": " 7bit"
|
||||
}
|
||||
],
|
||||
"type": "text/plain",
|
||||
"charset": "us-ascii"
|
||||
}
|
||||
],
|
||||
"htmlBody": [
|
||||
{
|
||||
"partId": "1",
|
||||
"blobId": "blob_0",
|
||||
"size": 61,
|
||||
"headers": [
|
||||
{
|
||||
"name": "Content-Type",
|
||||
"value": " text/plain; charset=us-ascii"
|
||||
},
|
||||
{
|
||||
"name": "Content-Transfer-Encoding",
|
||||
"value": " 7bit"
|
||||
}
|
||||
],
|
||||
"type": "text/plain",
|
||||
"charset": "us-ascii"
|
||||
}
|
||||
],
|
||||
"attachments": [
|
||||
{
|
||||
"partId": "2",
|
||||
"blobId": "blob_2",
|
||||
"size": 1979,
|
||||
"headers": [
|
||||
{
|
||||
"name": "Content-Type",
|
||||
"value": " message/rfc822"
|
||||
},
|
||||
{
|
||||
"name": "Content-Transfer-Encoding",
|
||||
"value": " 7bit"
|
||||
},
|
||||
{
|
||||
"name": "Content-Disposition",
|
||||
"value": " inline"
|
||||
}
|
||||
],
|
||||
"type": "message/rfc822",
|
||||
"disposition": "inline"
|
||||
}
|
||||
],
|
||||
"hasAttachment": true,
|
||||
"preview": "Fred,\n\nFire up Air Force One! We're going South!\n\nThanks,\nAl"
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
use std::sync::Arc;
|
||||
use std::{collections::BTreeSet, sync::Arc};
|
||||
|
||||
use jmap::{api::SessionManager, JMAP};
|
||||
use jmap_client::client::{Client, Credentials};
|
||||
@@ -136,6 +136,7 @@ pub fn replace_boundaries(string: String) -> String {
|
||||
pub fn replace_blob_ids(string: String) -> String {
|
||||
let values = find_values(&string, "blobId\":");
|
||||
if !values.is_empty() {
|
||||
let values = BTreeSet::from_iter(values).into_iter().collect::<Vec<_>>();
|
||||
replace_values(
|
||||
string,
|
||||
&values,
|
||||
|
||||
Reference in New Issue
Block a user