use of org.hisp.dhis.jsontree.JsonArray in project dhis2-core by dhis2.
the class GistFieldsControllerTest method testField_Access.
@Test
void testField_Access() {
JsonArray groups = GET("/users/{uid}/userGroups/gist?fields=id,access&headless=true", getSuperuserUid()).content();
assertEquals(1, groups.size());
JsonObject group = groups.getObject(0);
JsonObject access = group.getObject("access");
assertTrue(access.has("manage", "externalize", "write", "read", "update", "delete"));
assertTrue(access.getBoolean("manage").booleanValue());
assertTrue(access.getBoolean("externalize").booleanValue());
assertTrue(access.getBoolean("write").booleanValue());
assertTrue(access.getBoolean("read").booleanValue());
assertTrue(access.getBoolean("update").booleanValue());
assertTrue(access.getBoolean("delete").booleanValue());
}
use of org.hisp.dhis.jsontree.JsonArray in project dhis2-core by dhis2.
the class SystemControllerTest method testGetTaskJsonByUid.
@Test
void testGetTaskJsonByUid() {
JsonArray task = GET("/system/tasks/{jobType}/{jobId}", "META_DATA_SYNC", "xyz").content(HttpStatus.OK);
assertTrue(task.isArray());
assertEquals(0, task.size());
}
use of org.hisp.dhis.jsontree.JsonArray in project dhis2-core by dhis2.
the class MeControllerTest method testGetCurrentUserDataApprovalWorkflows.
@Test
void testGetCurrentUserDataApprovalWorkflows() {
JsonArray workflows = GET("/me/dataApprovalWorkflows").content().getArray("dataApprovalWorkflows");
assertTrue(workflows.isArray());
assertTrue(workflows.isEmpty());
}
use of org.hisp.dhis.jsontree.JsonArray in project dhis2-core by dhis2.
the class OrganisationUnitLocationControllerTest method testGetParentByLocation.
@Test
void testGetParentByLocation() {
JsonArray parents = GET("/organisationUnitLocations/orgUnitByLocation?longitude=23.1&latitude=56.2").content(HttpStatus.OK);
assertTrue(parents.isArray());
assertTrue(parents.isEmpty());
}
use of org.hisp.dhis.jsontree.JsonArray in project dhis2-core by dhis2.
the class AbstractCrudControllerTest method replaceTranslationsForNotTranslatableObject.
@Test
void replaceTranslationsForNotTranslatableObject() {
String id = getCurrentUser().getUid();
JsonArray translations = GET("/users/{id}/translations", id).content().getArray("translations");
assertTrue(translations.isEmpty());
JsonWebMessage message = assertWebMessage("Conflict", 409, "WARNING", "One more more errors occurred, please see full details in import report.", PUT("/users/" + id + "/translations", "{'translations': [{'locale':'sv', 'property':'name', 'value':'namn'}]}").content(HttpStatus.CONFLICT));
JsonErrorReport error = message.find(JsonErrorReport.class, report -> report.getErrorCode() == ErrorCode.E1107);
assertEquals("Object type `User` is not translatable.", error.getMessage());
}
Aggregations