use of org.hisp.dhis.jsontree.JsonObject 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.JsonObject in project dhis2-core by dhis2.
the class GistFieldsControllerTest method testField_ApiEndpoints_AbsoluteURLs.
@Test
void testField_ApiEndpoints_AbsoluteURLs() {
JsonObject groups = GET("/users/{uid}/userGroups/gist?fields=name,users&absoluteUrls=true", getSuperuserUid()).content();
assertTrue(groups.getArray("userGroups").getObject(0).getObject("apiEndpoints").getString("users").string().startsWith("http://"));
}
use of org.hisp.dhis.jsontree.JsonObject in project dhis2-core by dhis2.
the class GistFieldsControllerTest method testField_ApiEndpoints_ContainsOnlyNonEmpty.
@Test
void testField_ApiEndpoints_ContainsOnlyNonEmpty() {
String noUsersGroupId = assertStatus(HttpStatus.CREATED, POST("/userGroups/", "{'name':'groupX', 'users':[]}"));
JsonObject group = GET("/userGroups/{uid}/gist?fields=name,users", noUsersGroupId).content();
assertFalse(group.getObject("apiEndpoints").getString("users").exists());
group = GET("/userGroups/{uid}/gist?fields=name,users::size", noUsersGroupId).content();
assertFalse(group.getObject("apiEndpoints").getString("users").exists());
group = GET("/userGroups/{uid}/gist?fields=name,users", userGroupId).content();
assertTrue(group.getObject("apiEndpoints").getString("users").exists());
group = GET("/userGroups/{uid}/gist?fields=name,users::size", userGroupId).content();
assertTrue(group.getObject("apiEndpoints").getString("users").exists());
}
use of org.hisp.dhis.jsontree.JsonObject in project dhis2-core by dhis2.
the class GistPagerControllerTest method testPager_Total_ResultBased.
@Test
void testPager_Total_ResultBased() {
JsonObject gist = GET("/users/{uid}/userGroups/gist?fields=name,users&total=true", getSuperuserUid()).content();
assertHasPager(gist, 1, 50, 1);
}
use of org.hisp.dhis.jsontree.JsonObject in project dhis2-core by dhis2.
the class GistPagerControllerTest method testPager_Total_CountQueryNonExistingPage.
@Test
void testPager_Total_CountQueryNonExistingPage() {
JsonObject gist = GET("/users/{uid}/userGroups/gist?fields=name,users&total=true&page=6", getSuperuserUid()).content();
assertHasPager(gist, 6, 50, 1);
}
Aggregations