You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@james.apache.org by rc...@apache.org on 2021/12/02 02:15:12 UTC
[james-project] 02/02: JAMES-3534 Identity/destroy should not fail for identities whose alias is deleted
This is an automated email from the ASF dual-hosted git repository.
rcordier pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/james-project.git
commit c41fe7a2723112ca4dbb0dd814c23127c5764d5f
Author: Quan Tran <hq...@linagora.com>
AuthorDate: Wed Nov 24 17:06:39 2021 +0700
JAMES-3534 Identity/destroy should not fail for identities whose alias is deleted
---
.../rfc8621/contract/IdentitySetContract.scala | 84 +++++++++++++++++++++-
1 file changed, 82 insertions(+), 2 deletions(-)
diff --git a/server/protocols/jmap-rfc-8621-integration-tests/jmap-rfc-8621-integration-tests-common/src/main/scala/org/apache/james/jmap/rfc8621/contract/IdentitySetContract.scala b/server/protocols/jmap-rfc-8621-integration-tests/jmap-rfc-8621-integration-tests-common/src/main/scala/org/apache/james/jmap/rfc8621/contract/IdentitySetContract.scala
index c2d0ec0..4f18081 100644
--- a/server/protocols/jmap-rfc-8621-integration-tests/jmap-rfc-8621-integration-tests-common/src/main/scala/org/apache/james/jmap/rfc8621/contract/IdentitySetContract.scala
+++ b/server/protocols/jmap-rfc-8621-integration-tests/jmap-rfc-8621-integration-tests-common/src/main/scala/org/apache/james/jmap/rfc8621/contract/IdentitySetContract.scala
@@ -1537,7 +1537,6 @@ trait IdentitySetContract {
|}""".stripMargin)
}
-
@Test
def updateShouldAcceptServerSetId(): Unit = {
val identityId: String = `given`
@@ -1666,5 +1665,86 @@ trait IdentitySetContract {
| ]
|}""".stripMargin)
}
-
+
+ @Test
+ def givenUpdatedServerSetIdentityWhenAdminRemoveThatIdentityThenDestroyThatIdentityShouldSucceed(server: GuiceJamesServer): Unit = {
+ // server create a alias for Bob
+ server.getProbe(classOf[DataProbeImpl]).addUserAliasMapping("bob-alias", "domain.tld", "bob@domain.tld")
+ val serverIdentityId = UUID.nameUUIDFromBytes("bob-alias@domain.tld".getBytes(StandardCharsets.UTF_8))
+
+ // Bob update serverIdentity
+ `given`
+ .body(
+ s"""{
+ | "using": ["urn:ietf:params:jmap:core", "urn:ietf:params:jmap:submission"],
+ | "methodCalls": [
+ | [
+ | "Identity/set",
+ | {
+ | "accountId": "29883977c13473ae7cb7678ef767cbfbaffc8a44a6e463d971d23a65c1dc4af6",
+ | "update": {
+ | "$serverIdentityId": {
+ | "name": "NewName1",
+ | "replyTo": [{
+ | "name": "Difference Alice",
+ | "email": "alice2@domain.tld"
+ | }],
+ | "bcc": [{
+ | "name": "Difference David",
+ | "email": "david2@domain.tld"
+ | }],
+ | "textSignature": "Difference text signature",
+ | "htmlSignature": "<p>Difference html signature</p>"
+ | }
+ | }
+ | },
+ | "c1"
+ | ]
+ | ]
+ |}""".stripMargin)
+ .when
+ .post
+ .`then`
+ .statusCode(SC_OK)
+
+ // server delete provided alias
+ server.getProbe(classOf[DataProbeImpl]).removeUserAliasMapping("bob-alias", "domain.tld", "bob@domain.tld")
+
+ // Bob delete that serverIdentity
+ val request: String =
+ s"""{
+ | "using": ["urn:ietf:params:jmap:core", "urn:ietf:params:jmap:submission"],
+ | "methodCalls": [
+ | [
+ | "Identity/set",
+ | {
+ | "accountId": "29883977c13473ae7cb7678ef767cbfbaffc8a44a6e463d971d23a65c1dc4af6",
+ | "destroy": ["$serverIdentityId"]
+ | },
+ | "c1"
+ | ]
+ | ]
+ |}""".stripMargin
+
+ val response: String = `given`
+ .body(request)
+ .when
+ .post
+ .`then`
+ .statusCode(SC_OK)
+ .contentType(JSON)
+ .extract
+ .body
+ .asString
+
+ // serverIdentity should be destroyed
+ assertThatJson(response)
+ .inPath("methodResponses[0][1]")
+ .isEqualTo(
+ s"""{
+ | "accountId": "29883977c13473ae7cb7678ef767cbfbaffc8a44a6e463d971d23a65c1dc4af6",
+ | "newState": "2c9f1b12-b35a-43e6-9af2-0106fb53a943",
+ | "destroyed": ["$serverIdentityId"]
+ |}""".stripMargin)
+ }
}
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@james.apache.org
For additional commands, e-mail: notifications-help@james.apache.org