Search in sources :

Example 1 with SomeUserId

use of org.hisp.dhis.webapi.snippets.SomeUserId 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());
}
Also used : JsonError(org.hisp.dhis.webapi.json.domain.JsonError) SomeUserId(org.hisp.dhis.webapi.snippets.SomeUserId) DhisControllerConvenienceTest(org.hisp.dhis.webapi.DhisControllerConvenienceTest) Test(org.junit.jupiter.api.Test)

Example 2 with SomeUserId

use of org.hisp.dhis.webapi.snippets.SomeUserId in project dhis2-core by dhis2.

the class AbstractCrudControllerTest method testGetObject.

@Test
void testGetObject() {
    String id = run(SomeUserId::new);
    JsonUser userById = GET("/users/{id}", id).content(HttpStatus.OK).as(JsonUser.class);
    assertTrue(userById.exists());
    assertEquals(id, userById.getId());
}
Also used : JsonUser(org.hisp.dhis.webapi.json.domain.JsonUser) SomeUserId(org.hisp.dhis.webapi.snippets.SomeUserId) DhisControllerConvenienceTest(org.hisp.dhis.webapi.DhisControllerConvenienceTest) Test(org.junit.jupiter.api.Test)

Aggregations

DhisControllerConvenienceTest (org.hisp.dhis.webapi.DhisControllerConvenienceTest)2 SomeUserId (org.hisp.dhis.webapi.snippets.SomeUserId)2 Test (org.junit.jupiter.api.Test)2 JsonError (org.hisp.dhis.webapi.json.domain.JsonError)1 JsonUser (org.hisp.dhis.webapi.json.domain.JsonUser)1