Search in sources :

Example 1 with JsonOrganisationUnit

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

the class MetadataWorkflowControllerTest method testAcceptUpdateProposal.

@Test
void testAcceptUpdateProposal() {
    String proposalId = postUpdateNameProposal(defaultTargetId, "New name");
    assertStatus(HttpStatus.OK, POST("/metadata/proposals/" + proposalId));
    JsonOrganisationUnit ou = GET("/organisationUnits/{uid}", defaultTargetId).content().as(JsonOrganisationUnit.class);
    assertEquals("New name", ou.getName());
    JsonMetadataProposal proposal = GET("/metadata/proposals/{uid}", proposalId).content().asObject(JsonMetadataProposal.class);
    assertEquals(MetadataProposalStatus.ACCEPTED, proposal.getStatus());
    assertNotNull(proposal.getFinalisedBy());
    assertNotNull(proposal.getFinalised());
}
Also used : JsonOrganisationUnit(org.hisp.dhis.webapi.json.domain.JsonOrganisationUnit) JsonMetadataProposal(org.hisp.dhis.webapi.controller.json.JsonMetadataProposal) DhisControllerConvenienceTest(org.hisp.dhis.webapi.DhisControllerConvenienceTest) Test(org.junit.jupiter.api.Test)

Example 2 with JsonOrganisationUnit

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

the class MetadataWorkflowControllerTest method testAcceptAddProposal.

@Test
void testAcceptAddProposal() {
    String proposalId = postAddProposal("My OU", "OU1");
    String ouId = assertStatus(HttpStatus.CREATED, POST("/metadata/proposals/" + proposalId));
    JsonOrganisationUnit ou = GET("/organisationUnits/{uid}", ouId).content().as(JsonOrganisationUnit.class);
    assertEquals("My OU", ou.getName());
    JsonMetadataProposal proposal = GET("/metadata/proposals/{uid}", proposalId).content().asObject(JsonMetadataProposal.class);
    assertEquals(MetadataProposalStatus.ACCEPTED, proposal.getStatus());
    assertNotNull(proposal.getFinalisedBy());
    assertNotNull(proposal.getFinalised());
}
Also used : JsonOrganisationUnit(org.hisp.dhis.webapi.json.domain.JsonOrganisationUnit) JsonMetadataProposal(org.hisp.dhis.webapi.controller.json.JsonMetadataProposal) DhisControllerConvenienceTest(org.hisp.dhis.webapi.DhisControllerConvenienceTest) Test(org.junit.jupiter.api.Test)

Aggregations

DhisControllerConvenienceTest (org.hisp.dhis.webapi.DhisControllerConvenienceTest)2 JsonMetadataProposal (org.hisp.dhis.webapi.controller.json.JsonMetadataProposal)2 JsonOrganisationUnit (org.hisp.dhis.webapi.json.domain.JsonOrganisationUnit)2 Test (org.junit.jupiter.api.Test)2