use of org.wso2.carbon.identity.api.server.idp.v1.model.Patch in project product-is by wso2.
the class SCIM2CustomSchemaMeTestCase method testPatchRemoveMyAttributes.
@Test(dependsOnMethods = "testPatchReplaceMyAttributes", description = "Tests patch remove operation for custom " + "schema attributes with /Me api")
public void testPatchRemoveMyAttributes() throws Exception {
String body = readResource("scim2-custom-schema-patch-remove-attribute.json");
Response response = getResponseOfPatch(ME_ENDPOINT, body, SCIM_CONTENT_TYPE);
ExtractableResponse<Response> extractableResponse = response.then().log().ifValidationFails().assertThat().statusCode(HttpStatus.SC_OK).and().assertThat().header(HttpHeaders.CONTENT_TYPE, SCIM_CONTENT_TYPE).extract();
Assert.assertNotNull(extractableResponse);
Object customSchema = extractableResponse.path(CUSTOM_SCHEMA_URI_WITH_ESCAPE_CHARS);
assertNotNull(customSchema);
Object country = ((LinkedHashMap) customSchema).get(COUNTRY_CLAIM_ATTRIBUTE_NAME);
assertNull(country);
LinkedHashMap manager = (LinkedHashMap) ((LinkedHashMap) customSchema).get(MANAGER_CLAIM_ATTRIBUTE_NAME);
assertNotNull(manager);
String managerEMail = manager.get(MANAGER_EMAIL_CLAIM_ATTRIBUTE_NAME).toString();
assertEquals(managerEMail, MANAGER_EMAIL_LOCAL_CLAIM_VALUE_AFTER_REPLACE);
}
use of org.wso2.carbon.identity.api.server.idp.v1.model.Patch in project product-is by wso2.
the class SCIM2CustomSchemaMeTestCase method testPatchAddMyAttributes.
@Test(dependsOnMethods = "testPutMyAttributes", description = "Tests patch add operation with custom schema " + "attributes using /Me api.")
public void testPatchAddMyAttributes() throws Exception {
String body = readResource("scim2-custom-schema-patch-add-attribute.json");
Response response = getResponseOfPatch(ME_ENDPOINT, body, SCIM_CONTENT_TYPE);
ExtractableResponse<Response> extractableResponse = response.then().log().ifValidationFails().assertThat().statusCode(HttpStatus.SC_OK).and().assertThat().header(HttpHeaders.CONTENT_TYPE, SCIM_CONTENT_TYPE).extract();
Assert.assertNotNull(extractableResponse);
Object customSchema = extractableResponse.path(CUSTOM_SCHEMA_URI_WITH_ESCAPE_CHARS);
assertNotNull(customSchema);
LinkedHashMap manager = (LinkedHashMap) ((LinkedHashMap) customSchema).get(MANAGER_CLAIM_ATTRIBUTE_NAME);
assertNotNull(manager);
String managerEMail = manager.get(MANAGER_EMAIL_CLAIM_ATTRIBUTE_NAME).toString();
assertEquals(managerEMail, "piraveenaAdd@gmail.com");
}
use of org.wso2.carbon.identity.api.server.idp.v1.model.Patch in project product-is by wso2.
the class SCIM2CustomSchemaMeTestCase method testPatchReplaceMyAttributes.
@Test(dependsOnMethods = "testGetMe", description = "Tests patch replace operation with custom schema " + "attributes with /Me api.")
public void testPatchReplaceMyAttributes() throws Exception {
String body = readResource("scim2-custom-schema-patch-replace-attribute.json");
Response response = getResponseOfPatch(ME_ENDPOINT, body, SCIM_CONTENT_TYPE);
ExtractableResponse<Response> extractableResponse = response.then().log().ifValidationFails().assertThat().statusCode(HttpStatus.SC_OK).and().assertThat().header(HttpHeaders.CONTENT_TYPE, SCIM_CONTENT_TYPE).extract();
Assert.assertNotNull(extractableResponse);
Object customSchema = extractableResponse.path(CUSTOM_SCHEMA_URI_WITH_ESCAPE_CHARS);
assertNotNull(customSchema);
String country = ((LinkedHashMap) customSchema).get(COUNTRY_CLAIM_ATTRIBUTE_NAME).toString();
assertEquals(country, COUNTRY_LOCAL_CLAIM_VALUE_AFTER_REPLACE);
LinkedHashMap manager = (LinkedHashMap) ((LinkedHashMap) customSchema).get(MANAGER_CLAIM_ATTRIBUTE_NAME);
assertNotNull(manager);
String managerEMail = manager.get(MANAGER_EMAIL_CLAIM_ATTRIBUTE_NAME).toString();
assertEquals(managerEMail, MANAGER_EMAIL_LOCAL_CLAIM_VALUE_AFTER_REPLACE);
}
use of org.wso2.carbon.identity.api.server.idp.v1.model.Patch in project product-is by wso2.
the class SCIM2CustomSchemaUserTestCase method testPatchAddUserAttributes.
@Test(dependsOnMethods = "testPutUserAttributes", description = "Tests patch add operation with custom schema " + "attributes using /Users api.")
public void testPatchAddUserAttributes() throws Exception {
String body = readResource("scim2-custom-schema-patch-add-attribute.json");
Response response = getResponseOfPatch(userIdEndpointURL, body, SCIM_CONTENT_TYPE);
ExtractableResponse<Response> extractableResponse = response.then().log().ifValidationFails().assertThat().statusCode(HttpStatus.SC_OK).and().assertThat().header(HttpHeaders.CONTENT_TYPE, SCIM_CONTENT_TYPE).extract();
Assert.assertNotNull(extractableResponse);
Object customSchema = extractableResponse.path(CUSTOM_SCHEMA_URI_WITH_ESCAPE_CHARS);
assertNotNull(customSchema);
LinkedHashMap manager = (LinkedHashMap) ((LinkedHashMap) customSchema).get(MANAGER_CLAIM_ATTRIBUTE_NAME);
assertNotNull(manager);
String managerEMail = manager.get(MANAGER_EMAIL_CLAIM_ATTRIBUTE_NAME).toString();
assertEquals(managerEMail, MANAGER_EMAIL_LOCAL_CLAIM_VALUE_AFTER_ADD);
}
use of org.wso2.carbon.identity.api.server.idp.v1.model.Patch in project product-is by wso2.
the class SCIM2CustomSchemaUserTestCase method testPatchReplaceUserAttributes.
@Test(dependsOnMethods = "testGetUsers", description = "Tests patch replace operation with custom schema " + "attributes with /Users api.")
public void testPatchReplaceUserAttributes() throws Exception {
String body = readResource("scim2-custom-schema-patch-replace-attribute.json");
Response response = getResponseOfPatch(userIdEndpointURL, body, SCIM_CONTENT_TYPE);
ExtractableResponse<Response> extractableResponse = response.then().log().ifValidationFails().assertThat().statusCode(HttpStatus.SC_OK).and().assertThat().header(HttpHeaders.CONTENT_TYPE, SCIM_CONTENT_TYPE).extract();
Assert.assertNotNull(extractableResponse);
Object customSchema = extractableResponse.path(CUSTOM_SCHEMA_URI_WITH_ESCAPE_CHARS);
assertNotNull(customSchema);
String country = ((LinkedHashMap) customSchema).get(COUNTRY_CLAIM_ATTRIBUTE_NAME).toString();
assertEquals(country, COUNTRY_LOCAL_CLAIM_VALUE_AFTER_REPLACE);
LinkedHashMap manager = (LinkedHashMap) ((LinkedHashMap) customSchema).get(MANAGER_CLAIM_ATTRIBUTE_NAME);
assertNotNull(manager);
String managerEMail = manager.get(MANAGER_EMAIL_CLAIM_ATTRIBUTE_NAME).toString();
assertEquals(managerEMail, MANAGER_EMAIL_LOCAL_CLAIM_VALUE_AFTER_REPLACE);
}
Aggregations