use of org.hisp.dhis.webapi.json.domain.JsonTypeReport in project dhis2-core by dhis2.
the class ProgramStageControllerTest method testCreateProgramStageWithoutProgram.
@Test
void testCreateProgramStageWithoutProgram() {
JsonWebMessage message = POST("/programStages/", "{'name':'test programStage'}").content(HttpStatus.CONFLICT).as(JsonWebMessage.class);
JsonTypeReport response = message.get("response", JsonTypeReport.class);
assertEquals(1, response.getErrorReports().size());
assertEquals(ErrorCode.E4053, response.getErrorReports().get(0).getErrorCode());
}
use of org.hisp.dhis.webapi.json.domain.JsonTypeReport in project dhis2-core by dhis2.
the class AbstractCrudControllerTest method testSetSharing_InvalidPublicAccess.
@Test
void testSetSharing_InvalidPublicAccess() {
String userId = getCurrentUser().getUid();
// first create an object which can be shared
String programId = assertStatus(HttpStatus.CREATED, POST("/programs/", "{'name':'test', 'shortName':'test', 'programType':'WITHOUT_REGISTRATION'}"));
String sharing = "{'owner':'" + userId + "', 'public':'illegal', 'external': true }";
JsonWebMessage message = PUT("/programs/" + programId + "/sharing", sharing).content(HttpStatus.CONFLICT).as(JsonWebMessage.class);
assertWebMessage("Conflict", 409, "ERROR", "One more more errors occurred, please see full details in import report.", message);
JsonTypeReport response = message.get("response", JsonTypeReport.class);
assertEquals(1, response.getObjectReports().size());
assertEquals(ErrorCode.E3015, response.getObjectReports().get(0).getErrorReports().get(0).getErrorCode());
}
Aggregations