Search in sources :

Example 26 with JsonObject

use of org.hisp.dhis.jsontree.JsonObject in project dhis2-core by dhis2.

the class MetadataImportExportControllerTest method testPostJsonMetadata_Pre38.

@Test
void testPostJsonMetadata_Pre38() {
    JsonObject report = POST("/37/metadata", "{'organisationUnits':[{'name':'My Unit', 'shortName':'OU1', 'openingDate': '2020-01-01'}]}").content(HttpStatus.OK);
    assertEquals("OK", report.getString("status").string());
}
Also used : GeoJsonObject(org.geojson.GeoJsonObject) JsonObject(org.hisp.dhis.jsontree.JsonObject) DhisControllerConvenienceTest(org.hisp.dhis.webapi.DhisControllerConvenienceTest) Test(org.junit.jupiter.api.Test)

Example 27 with JsonObject

use of org.hisp.dhis.jsontree.JsonObject in project dhis2-core by dhis2.

the class MetadataImportExportControllerTest method testPostCsvMetadata_Pre38.

@Test
void testPostCsvMetadata_Pre38() {
    JsonObject report = POST("/37/metadata?classKey=ORGANISATION_UNIT", Body(","), ContentType("application/csv")).content(HttpStatus.OK);
    assertEquals("OK", report.getString("status").string());
}
Also used : GeoJsonObject(org.geojson.GeoJsonObject) JsonObject(org.hisp.dhis.jsontree.JsonObject) DhisControllerConvenienceTest(org.hisp.dhis.webapi.DhisControllerConvenienceTest) Test(org.junit.jupiter.api.Test)

Example 28 with JsonObject

use of org.hisp.dhis.jsontree.JsonObject in project dhis2-core by dhis2.

the class SystemSettingControllerTest method testGetSystemSettingsJson.

@Test
void testGetSystemSettingsJson() {
    assertStatus(HttpStatus.OK, POST("/systemSettings/keyUiLocale?value=de"));
    JsonObject setting = GET("/systemSettings?key=keyUiLocale").content(HttpStatus.OK);
    assertTrue(setting.isObject());
    assertEquals(1, setting.size());
    assertEquals("de", setting.getString("keyUiLocale").string());
}
Also used : JsonObject(org.hisp.dhis.jsontree.JsonObject) DhisControllerConvenienceTest(org.hisp.dhis.webapi.DhisControllerConvenienceTest) Test(org.junit.jupiter.api.Test)

Example 29 with JsonObject

use of org.hisp.dhis.jsontree.JsonObject in project dhis2-core by dhis2.

the class MeControllerTest method testGetSettings.

@Test
void testGetSettings() {
    JsonObject settings = GET("/me/settings").content(HttpStatus.OK);
    assertTrue(settings.isObject());
    assertFalse(settings.isEmpty());
    assertTrue(settings.get("keyMessageSmsNotification").exists());
    assertEquals("en", settings.getString("keyUiLocale").string());
}
Also used : JsonObject(org.hisp.dhis.jsontree.JsonObject) DhisControllerConvenienceTest(org.hisp.dhis.webapi.DhisControllerConvenienceTest) Test(org.junit.jupiter.api.Test)

Example 30 with JsonObject

use of org.hisp.dhis.jsontree.JsonObject in project dhis2-core by dhis2.

the class MeControllerTest method testGetDashboard.

@Test
void testGetDashboard() {
    JsonObject dashboard = GET("/me/dashboard").content();
    assertEquals(0, dashboard.getNumber("unreadInterpretations").intValue());
    assertEquals(0, dashboard.getNumber("unreadMessageConversations").intValue());
}
Also used : JsonObject(org.hisp.dhis.jsontree.JsonObject) DhisControllerConvenienceTest(org.hisp.dhis.webapi.DhisControllerConvenienceTest) Test(org.junit.jupiter.api.Test)

Aggregations

JsonObject (org.hisp.dhis.jsontree.JsonObject)106 Test (org.junit.jupiter.api.Test)92 DhisControllerConvenienceTest (org.hisp.dhis.webapi.DhisControllerConvenienceTest)51 JsonArray (org.hisp.dhis.jsontree.JsonArray)16 ProgramInstance (org.hisp.dhis.program.ProgramInstance)6 TrackedEntityInstance (org.hisp.dhis.trackedentity.TrackedEntityInstance)6 Relationship (org.hisp.dhis.relationship.Relationship)5 RelationshipType (org.hisp.dhis.relationship.RelationshipType)5 GeoJsonObject (org.geojson.GeoJsonObject)3 JsonString (org.hisp.dhis.jsontree.JsonString)3 HttpStatus (org.springframework.http.HttpStatus)3 ObjectType (org.hisp.dhis.attribute.Attribute.ObjectType)2 ProgramStageInstance (org.hisp.dhis.program.ProgramStageInstance)2 Arrays.stream (java.util.Arrays.stream)1 Date (java.util.Date)1 JsonResponse (org.hisp.dhis.jsontree.JsonResponse)1 OrganisationUnit (org.hisp.dhis.organisationunit.OrganisationUnit)1 Program (org.hisp.dhis.program.Program)1 ApiToken (org.hisp.dhis.security.apikey.ApiToken)1 SettingKey (org.hisp.dhis.setting.SettingKey)1