Skip to content

Commit 3954a04

Browse files
committed
JAMES-3728 Test Email/se update combining move &setFlags
1 parent cbd0517 commit 3954a04

File tree

1 file changed

+59
-0
lines changed
  • server/protocols/jmap-rfc-8621-integration-tests/jmap-rfc-8621-integration-tests-common/src/main/scala/org/apache/james/jmap/rfc8621/contract

1 file changed

+59
-0
lines changed

server/protocols/jmap-rfc-8621-integration-tests/jmap-rfc-8621-integration-tests-common/src/main/scala/org/apache/james/jmap/rfc8621/contract/EmailSetMethodContract.scala

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6626,6 +6626,65 @@ trait EmailSetMethodContract {
66266626
|}""".stripMargin)
66276627
}
66286628

6629+
@Test
6630+
def updateShouldSupportMixingMoveAndFlagUpdate(server: GuiceJamesServer): Unit = {
6631+
val mailboxProbe = server.getProbe(classOf[MailboxProbeImpl])
6632+
val mailboxId1: MailboxId = mailboxProbe.createMailbox(MailboxPath.inbox(BOB))
6633+
val mailboxId2: MailboxId = mailboxProbe.createMailbox(MailboxPath.forUser(BOB, "other"))
6634+
val mailboxId3: MailboxId = mailboxProbe.createMailbox(MailboxPath.forUser(BOB, "yet-another"))
6635+
6636+
val messageId: MessageId = mailboxProbe
6637+
.appendMessage(BOB.asString, MailboxPath.inbox(BOB),
6638+
AppendCommand.from(
6639+
buildTestMessage))
6640+
.getMessageId
6641+
6642+
val request =
6643+
s"""{
6644+
| "using": ["urn:ietf:params:jmap:core","urn:ietf:params:jmap:mail"],
6645+
| "methodCalls": [
6646+
| ["Email/set", {
6647+
| "accountId": "29883977c13473ae7cb7678ef767cbfbaffc8a44a6e463d971d23a65c1dc4af6",
6648+
| "update": {
6649+
| "${messageId.serialize}": {
6650+
| "mailboxIds": {
6651+
| "${mailboxId1.serialize}": true,
6652+
| "${mailboxId2.serialize}": true
6653+
| },
6654+
| "keywords/music": true
6655+
| }
6656+
| }
6657+
| }, "c1"],
6658+
| ["Email/get", {
6659+
| "accountId": "29883977c13473ae7cb7678ef767cbfbaffc8a44a6e463d971d23a65c1dc4af6",
6660+
| "ids": ["${messageId.serialize}"],
6661+
| "properties": ["mailboxIds", "keywords"]
6662+
| }, "c3"]
6663+
| ]
6664+
|}""".stripMargin
6665+
6666+
val response = `given`
6667+
.header(ACCEPT.toString, ACCEPT_RFC8621_VERSION_HEADER)
6668+
.body(request)
6669+
.when
6670+
.post
6671+
.`then`
6672+
.statusCode(SC_OK)
6673+
.contentType(JSON)
6674+
.extract
6675+
.body
6676+
.asString
6677+
6678+
assertThatJson(response)
6679+
.inPath("methodResponses[1][1].list[0]")
6680+
.isEqualTo(
6681+
s"""{
6682+
| "id": "${messageId.serialize}",
6683+
| "mailboxIds": {"${mailboxId1.serialize}":true, "${mailboxId2.serialize}":true},
6684+
| "keywords" : {"music": true }
6685+
|}""".stripMargin)
6686+
}
6687+
66296688
@Test
66306689
def invalidPatchPropertyShouldFail(server: GuiceJamesServer): Unit = {
66316690
val mailboxProbe = server.getProbe(classOf[MailboxProbeImpl])

0 commit comments

Comments
 (0)