Search in sources :

Example 1 with JsonImportSummary

use of org.hisp.dhis.webapi.json.domain.JsonImportSummary in project dhis2-core by dhis2.

the class MetadataImportExportControllerTest method testPostProgramStageWithoutProgram.

@Test
void testPostProgramStageWithoutProgram() {
    JsonWebMessage message = POST("/metadata/", "{'programStages':[{'name':'test programStage'}]}").content(HttpStatus.CONFLICT).as(JsonWebMessage.class);
    JsonImportSummary response = message.get("response", JsonImportSummary.class);
    assertEquals(1, response.getTypeReports().get(0).getObjectReports().get(0).getErrorReports().size());
    assertEquals(ErrorCode.E4053, response.getTypeReports().get(0).getObjectReports().get(0).getErrorReports().get(0).getErrorCode());
}
Also used : JsonImportSummary(org.hisp.dhis.webapi.json.domain.JsonImportSummary) JsonWebMessage(org.hisp.dhis.webapi.json.domain.JsonWebMessage) DhisControllerConvenienceTest(org.hisp.dhis.webapi.DhisControllerConvenienceTest) Test(org.junit.jupiter.api.Test)

Example 2 with JsonImportSummary

use of org.hisp.dhis.webapi.json.domain.JsonImportSummary in project dhis2-core by dhis2.

the class DataValueSetControllerTest method testPostJsonDataValueSet_Pre38.

@Test
void testPostJsonDataValueSet_Pre38() {
    JsonImportSummary summary = POST("/37/dataValueSets/", "{}").content(HttpStatus.OK).as(JsonImportSummary.class);
    assertEquals("ImportSummary", summary.getResponseType());
    assertEquals("SUCCESS", summary.getStatus());
}
Also used : JsonImportSummary(org.hisp.dhis.webapi.json.domain.JsonImportSummary) DhisControllerConvenienceTest(org.hisp.dhis.webapi.DhisControllerConvenienceTest) Test(org.junit.jupiter.api.Test)

Example 3 with JsonImportSummary

use of org.hisp.dhis.webapi.json.domain.JsonImportSummary in project dhis2-core by dhis2.

the class DataValueSetControllerTest method testPostCsvDataValueSet_Pre38.

@Test
void testPostCsvDataValueSet_Pre38() {
    JsonImportSummary summary = POST("/37/dataValueSets/", Body("abc"), ContentType("application/csv")).content(HttpStatus.OK).as(JsonImportSummary.class);
    assertEquals("ImportSummary", summary.getResponseType());
    assertEquals("SUCCESS", summary.getStatus());
}
Also used : JsonImportSummary(org.hisp.dhis.webapi.json.domain.JsonImportSummary) DhisControllerConvenienceTest(org.hisp.dhis.webapi.DhisControllerConvenienceTest) Test(org.junit.jupiter.api.Test)

Example 4 with JsonImportSummary

use of org.hisp.dhis.webapi.json.domain.JsonImportSummary in project dhis2-core by dhis2.

the class CompleteDataSetRegistrationControllerTest method testPostCompleteRegistrationsJson_Pre38.

@Test
void testPostCompleteRegistrationsJson_Pre38() {
    JsonImportSummary summary = POST("/37/completeDataSetRegistrations", "{}").content(HttpStatus.OK).as(JsonImportSummary.class);
    assertEquals("ImportSummary", summary.getResponseType());
    assertEquals("ERROR", summary.getStatus());
}
Also used : JsonImportSummary(org.hisp.dhis.webapi.json.domain.JsonImportSummary) Test(org.junit.jupiter.api.Test) DhisControllerConvenienceTest(org.hisp.dhis.webapi.DhisControllerConvenienceTest)

Example 5 with JsonImportSummary

use of org.hisp.dhis.webapi.json.domain.JsonImportSummary in project dhis2-core by dhis2.

the class UserControllerTest method testPutJsonObject_Pre38.

@Test
void testPutJsonObject_Pre38() {
    JsonObject user = GET("/users/{uid}", peter.getUid()).content();
    JsonImportSummary summary = PUT("/37/users/" + peter.getUid(), user.toString()).content(HttpStatus.OK).as(JsonImportSummary.class);
    assertEquals("ImportReport", summary.getResponseType());
    assertEquals("OK", summary.getStatus());
    assertEquals(1, summary.getStats().getUpdated());
    assertEquals(peter.getUid(), summary.getTypeReports().get(0).getObjectReports().get(0).getUid());
}
Also used : JsonImportSummary(org.hisp.dhis.webapi.json.domain.JsonImportSummary) JsonObject(org.hisp.dhis.jsontree.JsonObject) DhisControllerConvenienceTest(org.hisp.dhis.webapi.DhisControllerConvenienceTest) Test(org.junit.jupiter.api.Test)

Aggregations

DhisControllerConvenienceTest (org.hisp.dhis.webapi.DhisControllerConvenienceTest)5 JsonImportSummary (org.hisp.dhis.webapi.json.domain.JsonImportSummary)5 Test (org.junit.jupiter.api.Test)5 JsonObject (org.hisp.dhis.jsontree.JsonObject)1 JsonWebMessage (org.hisp.dhis.webapi.json.domain.JsonWebMessage)1