chibenwa commented on a change in pull request #678:
URL: https://github.com/apache/james-project/pull/678#discussion_r721020756
##########
File path:
server/protocols/webadmin/webadmin-data/src/test/java/org/apache/james/webadmin/routes/AliasRoutesTest.java
##########
@@ -178,6 +185,26 @@ void putShouldDetectConflicts() {
.containsEntry("message", "Creation of redirection of
[email protected] to alias:[email protected] would lead to a loop, operation not
performed");
}
+ @Test
+ void putShouldDetectConflictsWithGroups() throws Exception {
+
memoryRecipientRewriteTable.addGroupMapping(MappingSource.fromUser(Username.of(ALICE_ALIAS)),
BOB);
+
+ Map<String, Object> errors = when()
+ .put(ALICE + SEPARATOR + "sources" + SEPARATOR +
ALICE_ALIAS)
+ .then()
+ .contentType(ContentType.JSON)
+ .statusCode(HttpStatus.BAD_REQUEST_400)
+ .extract()
+ .body()
+ .jsonPath()
+ .getMap(".");
+
+ assertThat(errors)
+ .containsEntry("statusCode", HttpStatus.BAD_REQUEST_400)
+ .containsEntry("type", "InvalidArgument")
+ .containsEntry("message", "'[email protected]' already have
associated mappings: group:[email protected]");
+ }
+
Review comment:
```
GIVEN an alias [email protected]
WHEN I create the alias [email protected]
THEN it fails
```
Invalid: a user can have several aliases...
```
GIVEN a user [email protected]
WHEN I create the alias [email protected]
THEN it fails
```
Test case already covered by
`putExistingUserAsAliasSourceShouldNotBePossible`
--
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]