-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: Migrate user group endpoints to Tapir and remove UserRouteA…
…DM (#3046)
- Loading branch information
Showing
24 changed files
with
707 additions
and
1,104 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,7 +5,6 @@ | |
|
||
package org.knora.webapi.messages.admin.responder.usersmessages | ||
|
||
import dsp.errors.BadRequestException | ||
import org.knora.webapi.* | ||
import org.knora.webapi.messages.admin.responder.permissionsmessages.PermissionProfileType | ||
import org.knora.webapi.sharedtestdata.SharedTestDataADM | ||
|
@@ -74,62 +73,4 @@ class UsersMessagesADMSpec extends CoreSpec { | |
) | ||
} | ||
} | ||
|
||
"The ChangeUserApiRequestADM case class" should { | ||
|
||
"throw a BadRequestException if number of parameters is wrong" in { | ||
|
||
// all parameters are None | ||
assertThrows[BadRequestException]( | ||
ChangeUserApiRequestADM() | ||
) | ||
|
||
val errorNoParameters = the[BadRequestException] thrownBy ChangeUserApiRequestADM() | ||
errorNoParameters.getMessage should equal("No data sent in API request.") | ||
|
||
// more than one parameter for status update | ||
assertThrows[BadRequestException]( | ||
ChangeUserApiRequestADM(status = Some(true), systemAdmin = Some(true)) | ||
) | ||
|
||
val errorTooManyParametersStatusUpdate = | ||
the[BadRequestException] thrownBy ChangeUserApiRequestADM(status = Some(true), systemAdmin = Some(true)) | ||
errorTooManyParametersStatusUpdate.getMessage should equal("Too many parameters sent for change request.") | ||
|
||
// more than one parameter for systemAdmin update | ||
assertThrows[BadRequestException]( | ||
ChangeUserApiRequestADM(systemAdmin = Some(true), status = Some(true)) | ||
) | ||
|
||
val errorTooManyParametersSystemAdminUpdate = | ||
the[BadRequestException] thrownBy ChangeUserApiRequestADM(systemAdmin = Some(true), status = Some(true)) | ||
errorTooManyParametersSystemAdminUpdate.getMessage should equal("Too many parameters sent for change request.") | ||
|
||
// more than 5 parameters for basic user information update | ||
assertThrows[BadRequestException]( | ||
ChangeUserApiRequestADM( | ||
username = Some("newUsername"), | ||
email = Some("[email protected]"), | ||
givenName = Some("newGivenName"), | ||
familyName = Some("familyName"), | ||
lang = Some("en"), | ||
status = Some(true), | ||
systemAdmin = Some(false) | ||
) | ||
) | ||
|
||
val errorTooManyParametersBasicInformationUpdate = the[BadRequestException] thrownBy ChangeUserApiRequestADM( | ||
username = Some("newUsername"), | ||
email = Some("[email protected]"), | ||
givenName = Some("newGivenName"), | ||
familyName = Some("familyName"), | ||
lang = Some("en"), | ||
status = Some(true), | ||
systemAdmin = Some(false) | ||
) | ||
errorTooManyParametersBasicInformationUpdate.getMessage should equal( | ||
"Too many parameters sent for change request." | ||
) | ||
} | ||
} | ||
} |
Oops, something went wrong.