chibenwa commented on a change in pull request #678:
URL: https://github.com/apache/james-project/pull/678#discussion_r721017803



##########
File path: 
server/protocols/webadmin/webadmin-data/src/test/java/org/apache/james/webadmin/routes/UserRoutesTest.java
##########
@@ -573,6 +581,38 @@ void 
puttingWithDomainPartInUsernameTwoTimesShouldNotBeAllowed() {
             assertThat(users).containsExactly(ImmutableMap.of("username", 
USERNAME_WITH_DOMAIN.asString()));
         }
 
+        @Test
+        void putShouldFailWhenConflictWithAlias(RecipientRewriteTable 
recipientRewriteTable) throws Exception {
+            
recipientRewriteTable.addAliasMapping(MappingSource.fromUser(USERNAME_WITH_DOMAIN),
+                OTHER_USERNAME_WITH_DOMAIN.asString());
+
+            given()
+                .body("{\"password\":\"password\"}")
+            .when()
+                .put(USERNAME_WITH_DOMAIN.asString())
+            .then()
+                .statusCode(HttpStatus.CONFLICT_409)
+                .body("statusCode", is(HttpStatus.CONFLICT_409))
+                .body("type", 
is(ErrorResponder.ErrorType.WRONG_STATE.getType()))
+                .body("message", is("'username@domain' already have associated 
mappings: alias:other@domain"));
+        }
+
+        @Test
+        void putShouldFailWhenConflictWithGroup(RecipientRewriteTable 
recipientRewriteTable) throws Exception {
+            
recipientRewriteTable.addGroupMapping(MappingSource.fromUser(USERNAME_WITH_DOMAIN),
+                OTHER_USERNAME_WITH_DOMAIN.asString());
+
+            given()
+                .body("{\"password\":\"password\"}")
+            .when()
+                .put(USERNAME_WITH_DOMAIN.asString())
+            .then()
+                .statusCode(HttpStatus.CONFLICT_409)
+                .body("statusCode", is(HttpStatus.CONFLICT_409))
+                .body("type", 
is(ErrorResponder.ErrorType.WRONG_STATE.getType()))
+                .body("message", is("'username@domain' already have associated 
mappings: group:other@domain"));
+        }
+

Review comment:
       This test already exist prior to my changeset.




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to