use of org.hisp.dhis.webapi.json.domain.JsonErrorReport in project dhis2-core by dhis2.
the class MetadataWorkflowControllerTest method testAcceptUpdateProposal_ConflictTargetAlreadyDeleted.
@Test
void testAcceptUpdateProposal_ConflictTargetAlreadyDeleted() {
String proposalId = postUpdateNameProposal(defaultTargetId, "New name");
assertStatus(HttpStatus.OK, DELETE("/organisationUnits/" + defaultTargetId));
JsonWebMessage message = assertWebMessage("Conflict", 409, "WARNING", "One more more errors occurred, please see full details in import report.", POST("/metadata/proposals/" + proposalId).content(HttpStatus.CONFLICT));
JsonErrorReport error = message.find(JsonErrorReport.class, report -> report.getErrorCode() == ErrorCode.E4015);
assertEquals("Property `targetId` refers to an object that does not exist, could not find `" + defaultTargetId + "`", error.getMessage());
assertEquals("targetId", error.getErrorProperties().get(0));
}
use of org.hisp.dhis.webapi.json.domain.JsonErrorReport in project dhis2-core by dhis2.
the class UserControllerTest method testPostJsonObjectInvalidUsername.
@Test
void testPostJsonObjectInvalidUsername() {
JsonWebMessage msg = assertWebMessage("Conflict", 409, "ERROR", "One more more errors occurred, please see full details in import report.", POST("/users/", "{'surname':'S.','firstName':'Harry','userCredentials':{'username':'Harrys'}}").content(HttpStatus.CONFLICT));
JsonErrorReport report = msg.getResponse().find(JsonErrorReport.class, error -> error.getErrorCode() == ErrorCode.E4049);
assertEquals("username", report.getErrorProperty());
}
use of org.hisp.dhis.webapi.json.domain.JsonErrorReport in project dhis2-core by dhis2.
the class UserControllerTest method testPutProperty_InvalidWhatsapp.
@Test
void testPutProperty_InvalidWhatsapp() {
JsonWebMessage msg = assertWebMessage("Conflict", 409, "ERROR", "One more more errors occurred, please see full details in import report.", PATCH("/users/" + peter.getUid() + "?importReportMode=ERRORS", "[{'op': 'add', 'path': '/whatsApp', 'value': 'not-a-phone-no'}]").content(HttpStatus.CONFLICT));
JsonErrorReport report = msg.getResponse().find(JsonErrorReport.class, error -> error.getErrorCode() == ErrorCode.E4027);
assertEquals("whatsApp", report.getErrorProperty());
}
Aggregations