use of org.hisp.dhis.webapi.json.domain.JsonError in project dhis2-core by dhis2.
the class JwtBearerTokenTest method assertInvalidTokenError.
private void assertInvalidTokenError(String expected, HttpResponse response) {
JsonError error = response.error(HttpStatus.UNAUTHORIZED);
assertEquals("invalid_token", error.getMessage());
assertEquals(expected, error.getDevMessage());
}
use of org.hisp.dhis.webapi.json.domain.JsonError in project dhis2-core by dhis2.
the class FollowupAnalysisControllerTest method testPerformFollowupAnalysis_ValidationMissingStartDate.
@Test
void testPerformFollowupAnalysis_ValidationMissingStartDate() {
JsonError error = GET("/dataAnalysis/followup?ou={ou}&de={de}&endDate=2020-01-01", orgUnitId, dataElementId).error(HttpStatus.CONFLICT);
assertEquals(ErrorCode.E2301, error.getErrorCode());
assertEquals("Start date and end date must be specified directly or indirectly by specifying a period", error.getMessage());
}
use of org.hisp.dhis.webapi.json.domain.JsonError in project dhis2-core by dhis2.
the class FollowupAnalysisControllerTest method testPerformFollowupAnalysis_ValidationMissingDataElement.
@Test
void testPerformFollowupAnalysis_ValidationMissingDataElement() {
JsonError error = GET("/dataAnalysis/followup?ou={ou}&pe=2021", orgUnitId).error(HttpStatus.CONFLICT);
assertEquals(ErrorCode.E2300, error.getErrorCode());
assertEquals("At least one data element or data set must be specified", error.getMessage());
}
use of org.hisp.dhis.webapi.json.domain.JsonError in project dhis2-core by dhis2.
the class AbstractCrudControllerTest method testPartialUpdateObject_Validation.
@Test
void testPartialUpdateObject_Validation() {
String id = run(SomeUserId::new);
JsonError error = PATCH("/users/" + id + "?importReportMode=ERRORS", "[{'op': 'add', 'path': '/email', 'value': 'Not-valid'}]").error();
assertEquals("Property `email` requires a valid email address, was given `Not-valid`.", error.getTypeReport().getErrorReports().get(0).getMessage());
}
use of org.hisp.dhis.webapi.json.domain.JsonError in project dhis2-core by dhis2.
the class FollowupAnalysisControllerTest method testPerformFollowupAnalysis_ValidationMissingOrganisationUnit.
@Test
void testPerformFollowupAnalysis_ValidationMissingOrganisationUnit() {
JsonError error = GET("/dataAnalysis/followup?de={de}&pe=2021", dataElementId).error(HttpStatus.CONFLICT);
assertEquals(ErrorCode.E2203, error.getErrorCode());
assertEquals("At least one organisation unit must be specified", error.getMessage());
}
Aggregations