Skip to content

Commit

Permalink
fix failing tests
Browse files Browse the repository at this point in the history
  • Loading branch information
amanda-ariyaratne committed Nov 7, 2024
1 parent 1018266 commit 67508bc
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@
*/
public class ClaimManagementNegativeTest extends ClaimManagementTestBase {

private static String testDialectId = "aHR0cDovL3VwZGF0ZWRkdW1teS5vcmcvY6xhaW0";
private static String testClaimId = "aHR0cDovL2ludmFsaWRkdW1teS5vcmcvY2xhaW0vZW1haWxhZGRyZXNz";
private static final String testDialectId = "aHR0cDovL3VwZGF0ZWRkdW1teS5vcmcvY6xhaW0";
private static final String testClaimId = "aHR0cDovL2ludmFsaWRkdW1teS5vcmcvY2xhaW0vZW1haWxhZGRyZXNz";

@Factory(dataProvider = "restAPIUserConfigProvider")
public ClaimManagementNegativeTest(TestUserMode userMode) throws Exception {
Expand Down Expand Up @@ -113,7 +113,7 @@ public void testRemoveSystemDefaultDialect() {
.then()
.log().ifValidationFails()
.assertThat()
.statusCode(HttpStatus.SC_BAD_REQUEST)
.statusCode(HttpStatus.SC_FORBIDDEN)
.body("code", equalTo("CMT-60008"));
}

Expand Down Expand Up @@ -142,7 +142,7 @@ public void testUpdateDefaultDialectURI() throws IOException {
response.then()
.log().ifValidationFails()
.assertThat()
.statusCode(HttpStatus.SC_BAD_REQUEST)
.statusCode(HttpStatus.SC_FORBIDDEN)
.body("code", equalTo("CMT-60007"));
}

Expand Down Expand Up @@ -194,13 +194,23 @@ public void testRemoveLocalClaimWithExternalClaimAssociation() throws IOExceptio
}

@Test
public void testRemoveDefaultLocalClaim() {
public void testRemoveDefaultLocalClaim() throws IOException {

String defaultLocalClaimId = "aHR0cDovL3dzbzIub3JnL2NsYWltcy9lbWFpbGFkZHJlc3M";
String dialectId = "dXJuOmlldGY6cGFyYW1zOnNjaW06c2NoZW1hczpjb3JlOjIuMA";
String claimId = "dXJuOmlldGY6cGFyYW1zOnNjaW06c2NoZW1hczpjb3JlOjIuMDptZXRhLnJlc291cmNlVHlwZQ==";

Response response =
getResponseOfDelete(CLAIM_DIALECTS_ENDPOINT_URI + LOCAL_CLAIMS_ENDPOINT_URI + "/" + defaultLocalClaimId);
validateErrorResponse(response, HttpStatus.SC_BAD_REQUEST, "CMT-60006");
String body = readResource("claim-management-update-default-external-claim.json");
Response response = getResponseOfPut(CLAIM_DIALECTS_ENDPOINT_URI + "/" + dialectId + CLAIMS_ENDPOINT_URI +
"/" + claimId, body);
response.then()
.assertThat()
.statusCode(HttpStatus.SC_OK);

String defaultLocalClaimId = "aHR0cDovL3dzbzIub3JnL2NsYWltcy9yZXNvdXJjZVR5cGU=";

response = getResponseOfDelete(CLAIM_DIALECTS_ENDPOINT_URI + LOCAL_CLAIMS_ENDPOINT_URI +
"/" + defaultLocalClaimId);
validateErrorResponse(response, HttpStatus.SC_FORBIDDEN, "CMT-60006");
}

@Test
Expand Down Expand Up @@ -283,7 +293,7 @@ public void testAddExternalClaimWithInvalidMappedClaim() throws IOException {
String body = readResource("claim-management-add-external-claim-invalid-mapped-claim.json");
Response response = getResponseOfPost(CLAIM_DIALECTS_ENDPOINT_URI + "/" + dialectId + CLAIMS_ENDPOINT_URI,
body);
validateErrorResponse(response, HttpStatus.SC_BAD_REQUEST, "CMT-600011");
validateErrorResponse(response, HttpStatus.SC_BAD_REQUEST, "CMT-50036");

removeDialect(dialectId);
}
Expand Down Expand Up @@ -326,16 +336,6 @@ public void testAddExternalClaimWithAlreadyMappedLocalClaim() throws IOException
removeDialect(dialectId);
}

@Test
public void testUpdateExternalClaimWithInvalidClaimURI() {

}

@Test
public void testUpdateExternalClaimWithAlreadyMappedLocalClaim() {

}

@Test
public void testPaginationLimitNotImplemented() {

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"claimURI": "urn:ietf:params:scim:schemas:core:2.0:meta.resourceType",
"mappedLocalClaimURI": "http://wso2.org/claims/userType"
}

0 comments on commit 67508bc

Please sign in to comment.