mirror of
https://github.com/floci-io/floci.git
synced 2026-12-01 01:12:48 -05:00
fix(cognito): name missing user pools in errors (#2936)
* fix(cognito): name missing user pools in errors * test(cognito): address missing pool review
This commit is contained in:
1 parent
14ca62d9f7
commit
c30ca8fb5f
5 files changed
+45
-7
No files matched your search
@@ -230,6 +230,20 @@ class CognitoIntegrationTest {
|
||||
assertFalse(sub.path("Mutable").asBoolean(), "sub must not be Mutable");
|
||||
}
|
||||
|
||||
@Test
|
||||
@Order(5)
|
||||
void describeUnknownUserPoolNamesPoolInResourceNotFoundMessage() {
|
||||
String missingPoolId = "us-east-1_000000000";
|
||||
|
||||
cognitoAction("DescribeUserPool", """
|
||||
{ "UserPoolId": "%s" }
|
||||
""".formatted(missingPoolId))
|
||||
.then()
|
||||
.statusCode(400)
|
||||
.body("__type", equalTo("ResourceNotFoundException"))
|
||||
.body("message", equalTo("User pool " + missingPoolId + " does not exist."));
|
||||
}
|
||||
|
||||
@Test
|
||||
@Order(6)
|
||||
void confirmForgotPasswordRejectsWrongConfirmationCode() throws Exception {
|
||||
|
||||
@@ -1468,6 +1468,20 @@ class CognitoServiceTest {
|
||||
assertEquals(400, ex.getHttpStatus());
|
||||
}
|
||||
|
||||
@Test
|
||||
void confirmSignUpNamesDeletedUserPoolInResourceNotFoundMessage() {
|
||||
UserPool pool = service.createUserPool(Map.of("PoolName", "TestPool"), "us-east-1");
|
||||
UserPoolClient client = service.createUserPoolClient(
|
||||
pool.getId(), "test-client", false, false, List.of(), List.of());
|
||||
service.deleteUserPool(pool.getId());
|
||||
|
||||
AwsException ex = assertThrows(AwsException.class, () ->
|
||||
service.confirmSignUp(client.getClientId(), "carol", "123456"));
|
||||
assertEquals("ResourceNotFoundException", ex.getErrorCode());
|
||||
assertEquals("User pool " + pool.getId() + " does not exist.", ex.getMessage());
|
||||
assertEquals(400, ex.getHttpStatus());
|
||||
}
|
||||
|
||||
@ParameterizedTest
|
||||
@CsvSource({"email_verified", "phone_number_verified"})
|
||||
@SuppressWarnings("unchecked")
|
||||
@@ -1854,9 +1868,12 @@ class CognitoServiceTest {
|
||||
|
||||
@Test
|
||||
void adminGetUserRejectsUnknownPoolWithResourceNotFound() {
|
||||
String missingPoolId = "us-east-1_missing";
|
||||
|
||||
AwsException ex = assertThrows(AwsException.class,
|
||||
() -> service.adminGetUser("us-east-1_missing", "bob"));
|
||||
() -> service.adminGetUser(missingPoolId, "bob"));
|
||||
assertEquals("ResourceNotFoundException", ex.getErrorCode());
|
||||
assertEquals("User pool " + missingPoolId + " does not exist.", ex.getMessage());
|
||||
assertEquals(400, ex.getHttpStatus());
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -88,7 +88,7 @@ class S3WellKnownKeyIntegrationTest {
|
||||
.then()
|
||||
.extract().asString();
|
||||
|
||||
if (body.contains("ResourceNotFoundException") || body.contains("User pool not found")) {
|
||||
if (body.contains("ResourceNotFoundException") || body.contains("User pool ")) {
|
||||
throw new AssertionError(
|
||||
"GET /" + BUCKET + "/" + JWKS_KEY
|
||||
+ " was routed to Cognito instead of S3. Response: " + body);
|
||||
|
||||
Reference in new issue
Block a user