" \"isDraft\": true," + " \"isForwarded\": true," + " \"mailboxIds\": [\"" + getDraftId(accessToken) + "\"]" + " }}" + " }," +
" \"subject\": \"subject\"," + " \"keywords\": {\"$Flagged\": true}," + " \"mailboxIds\": [\"" + getDraftId(accessToken) + "\"]" + " }}" + " }," +
" {" + " \"update\": { \"" + messageId + "\" : {" + " \"mailboxIds\": [\"" + getInboxId(accessToken) + "\",\"" + getDraftId(accessToken) + "\"]" + " }}" + " }," +
" \"subject\": \"subject\"," + " \"keywords\": {\"$Draft\": true}," + " \"mailboxIds\": [\"" + getDraftId(accessToken) + "\", \"" + getOutboxId(accessToken) + "\"]" + " }}" + " }," +
" {\"blobId\" : \"wrong\", \"type\" : \"image/jpeg\", \"size\" : 1337}" + " ]," + " \"mailboxIds\": [\"" + getDraftId(accessToken) + "\"]" + " }}" + " }," +
" \"subject\": \"subject\"," + " \"keywords\": {\"$Draft\": true}," + " \"mailboxIds\": [\"" + getDraftId(accessToken) + "\"]" + " }}" + " }," + " \"update\": { \"" + draftId + "\" : {" + " \"keywords\": {\"$Draft\":true}," + " \"mailboxIds\": [\"" + getOutboxId(accessToken) + "\",\"" + getDraftId(accessToken) + "\"]" + " }}" + " }," +
" \"subject\": \"subject\"," + " \"isDraft\": true," + " \"mailboxIds\": [\"" + getDraftId(accessToken) + "\"]" + " }}" + " }," +
" \"subject\": \"subject\"," + " \"keywords\": {\"$Draft\": true}," + " \"mailboxIds\": [\"" + getDraftId(accessToken) + "\"]" + " }}" + " }," +
String messageCreationId = "creationId1337"; String fromAddress = USERNAME; String draftId = getDraftId(accessToken); String requestBody = "[" + " [" +
" \"subject\": \"subject\"," + " \"keywords\": {\"$Draft\": true}," + " \"mailboxIds\": [\"" + getDraftId(accessToken) + "\"]" + " }}" + " }," +
" \"subject\": \"subject\"," + " \"keywords\": {\"$Draft\": true}," + " \"mailboxIds\": [\"" + getDraftId(accessToken) + "\"]" + " }}" + " }," +
" \"subject\": \"subject\"," + " \"keywords\": {\"$Draft\": true}," + " \"mailboxIds\": [\"" + getDraftId(accessToken) + "\"]" + " }}" + " }," +
" \"subject\": \"subject\"," + " \"isDraft\": true," + " \"mailboxIds\": [\"" + getDraftId(accessToken) + "\"]" + " }}" + " }," +
@Test public void setMessagesShouldAllowDraftCreationWithoutFrom() { String messageCreationId = "creationId1337"; String requestBody = "[" + " [" + " \"setMessages\"," + " {" + " \"create\": { \"" + messageCreationId + "\" : {" + " \"to\": [{ \"name\": \"BOB\", \"email\": \"someone@example.com\"}]," + " \"subject\": \"subject\"," + " \"keywords\": {\"$Draft\": true}," + " \"mailboxIds\": [\"" + getDraftId(accessToken) + "\"]" + " }}" + " }," + " \"#0\"" + " ]" + "]"; given() .header("Authorization", accessToken.serialize()) .body(requestBody) .when() .post("/jmap") .then() .log().ifValidationFails() .statusCode(200) .body(NAME, equalTo("messagesSet")) .body(ARGUMENTS + ".notCreated", aMapWithSize(0)) .body(ARGUMENTS + ".created", aMapWithSize(1)) .body(ARGUMENTS + ".created", hasKey(messageCreationId)); }
@Test public void setMessagesShouldAllowDraftCreationWithoutRecipients() { String messageCreationId = "creationId1337"; String requestBody = "[" + " [" + " \"setMessages\"," + " {" + " \"create\": { \"" + messageCreationId + "\" : {" + " \"from\": { \"name\": \"Me\", \"email\": \"invalid@domain.com\"}," + " \"subject\": \"subject\"," + " \"keywords\": {\"$Draft\": true}," + " \"mailboxIds\": [\"" + getDraftId(accessToken) + "\"]" + " }}" + " }," + " \"#0\"" + " ]" + "]"; given() .header("Authorization", accessToken.serialize()) .body(requestBody) .when() .post("/jmap") .then() .log().ifValidationFails() .statusCode(200) .body(NAME, equalTo("messagesSet")) .body(ARGUMENTS + ".notCreated", aMapWithSize(0)) .body(ARGUMENTS + ".created", aMapWithSize(1)) .body(ARGUMENTS + ".created", hasKey(messageCreationId)); }
" \"subject\": \"subject\"," + " \"keywords\": {\"$Draft\": true}," + " \"mailboxIds\": [\"" + getDraftId(accessToken) + "\"]" + " }}" + " }," +
" \"subject\": \"subject\"," + " \"keywords\": {\"$Draft\": true}," + " \"mailboxIds\": [\"" + getDraftId(accessToken) + "\"]" + " }}" + " }," +
" \"textBody\": \"You talking to me?\"," + " \"keywords\": {\"$Draft\": true}," + " \"mailboxIds\": [\"" + getDraftId(accessToken) + "\"]" + " }}" + " }," +
" \"subject\": \"subject\"," + " \"keywords\": {\"$Draft\": true}," + " \"mailboxIds\": [\"" + getDraftId(accessToken) + "\", \"" + mailboxId.serialize() + "\"]" + " }}" + " }," +
" \"subject\": \"subject\"," + " \"keywords\": {\"$Draft\": true}," + " \"mailboxIds\": [\"" + getDraftId(accessToken) + "\"]" + " }}" + " }," +